Commit 94b2ca18 authored by 李丛阳's avatar 李丛阳

freemarker

parent 5a3c63ac
package org.rcisoft.config;
import org.quartz.Scheduler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
import static com.sun.tools.doclint.Entity.ge;
/**
* Created by lcy on 18/1/11.
*/
@Configuration
public class QuartzConfig {
/**
* attention:
* Details:定义quartz调度工厂
*/
@Bean(name = "schedulerFactory")
public SchedulerFactoryBean schedulerFactory() {
SchedulerFactoryBean bean = new SchedulerFactoryBean();
// 用于quartz集群,QuartzScheduler 启动时更新己存在的Job
bean.setOverwriteExistingJobs(true);
// 延时启动,应用启动1秒后
bean.setStartupDelay(1);
// 注册触发器
//bean.setTriggers(cronJobTrigger);
return bean;
}
@Bean(name = "scheduler")
public Scheduler schedulerFactory(SchedulerFactoryBean bean) {
return bean.getScheduler();
}
}
\ No newline at end of file
......@@ -24,7 +24,7 @@ public enum ResultServiceEnums {
LOGIN_HEADER_ERROR(19,"不合法的Authorization header"),
PARAMER_ERROR(20,"参数错误"),
PARAMETER_ERROR(20,"参数错误"),
UPLOAD_FILE_ERROR(26,"上传图片失败"),
......
package org.rcisoft.core.util;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Zip;
import org.apache.tools.ant.types.FileSet;
import java.io.File;
import java.io.Serializable;
/**
* Created by lcy on 17/7/6.
*
* 压缩
*/
public class ZipCompress implements Serializable {
private static final long serialVersionUID = -2522528934048955246L;
public ZipCompress() {
}
/**
* 执行压缩操作
* @param srcPathName 需要被压缩的文件/文件夹
*/
public static void compressExe(String srcPathName,String dest) {
File srcdir = new File(srcPathName);
if (!srcdir.exists()){
throw new RuntimeException(srcPathName + "不存在!");
}
File zipFile = new File(dest);
Project prj = new Project();
Zip zip = new Zip();
zip.setProject(prj);
zip.setDestFile(zipFile);
FileSet fileSet = new FileSet();
fileSet.setProject(prj);
fileSet.setDir(srcdir);
//fileSet.setIncludes("**/*.java"); //包括哪些文件或文件夹 eg:zip.setIncludes("*.java");
fileSet.setExcludes(".DS_Store"); //排除哪些文件或文件夹
zip.addFileset(fileSet);
zip.execute();
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
ZipCompress book = new ZipCompress();
try{
book.compressExe(
"/working/virtualDirectory/projectFiles/family/upload/codegenerate/0d76004eccb54b03ab9a07de145f520e/20170706224325/",
"/working/ZipTestCompressing.zip");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
package org.rcisoft.business.${table.entityName?lower_case}.dao;
import org.rcisoft.core.base.BaseMapper
import org.rcisoft.business.${table.entityName?lower_case}.entity.${table.entityName};
import java.util.List;
/**
* Created with ${author} on ${.now}.
*/
@Repository
public interface ${table.entityName}Repository extends BaseMapper<${table.entityName}> {
/**
* 分页查询 ${table.entityName?uncap_first}
*
*/
@Select("<script>select * from ${table.tableName} where 1=1 "
+ "<if test=\"delFlag !=null and delFlag != '' \">and del_flag = ${r'#{delFlag}'} </if>' "
+ "<if test=\"flag !=null and flag != '' \">and flag = ${r'#{flag}'} </if>' "
+ "</script>")
@ResultMap(value = "BaseResultMap" )
List<${table.entityName}> query${table.entityName}s(${table.entityName} ${table.entityName?uncap_first});
}
package org.rcisoft.business.${table.entityName?lower_case}.service;
import org.rcisoft.business.${table.entityName?lower_case}.entity.${table.entityName};
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.aop.PageUtil;
import java.util.List;
/**
* Created by ${author} on ${.now}.
*/
public interface ${table.entityName}Service {
/**
* 保存 ${table.tableRemark!}
* @param ${table.entityName?uncap_first}
* @return
*/
PersistModel save(${table.entityName} ${table.entityName?uncap_first});
/**
* 逻辑删除 ${table.tableRemark!}
* @param ${table.entityName?uncap_first}
* @return
*/
PersistModel remove(${table.entityName} ${table.entityName?uncap_first});
/**
* 修改 ${table.tableRemark!}
* @param ${table.entityName?uncap_first}
* @return
*/
PersistModel merge(${table.entityName} ${table.entityName?uncap_first});
/**
* 根据id查询 ${table.tableRemark!}
* @param id
* @return
*/
${table.entityName} findById(String id);
/**
* 分页查询 ${table.tableRemark!}
* @param ${table.entityName?uncap_first}
* @return
*/
List<${table.entityName}> findAllByPagination(PageUtil<${table.entityName}> paginationUtility,
${table.entityName} ${table.entityName?uncap_first});
}
package org.rcisoft.business.${table.entityName?lower_case}.service.impl;
import org.rcisoft.core.util.UserUtil;
import org.rcisoft.business.${table.entityName?lower_case}.dao.${table.entityName}Repository;
import org.rcisoft.business.${table.entityName?lower_case}.entity.${table.entityName};
import org.rcisoft.business.${table.entityName?lower_case}.service.${table.entityName}Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import lombok.extern.slf4j.Slf4j;
/**
* Created by ${author} on ${.now}.
*/
@Service
@Transactional(readOnly = true,propagation = Propagation.NOT_SUPPORTED)
@Slf4j
public class ${table.entityName}ServiceImpl implements ${table.entityName}Service {
@Autowired
private ${table.entityName}Repository ${table.entityName?uncap_first}Repository;
/**
* 保存 ${table.entityName?uncap_first}
* @param ${table.entityName?uncap_first}
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
PersistModel save(${table.entityName} ${table.entityName?uncap_first}){
${table.entityName?uncap_first}.setCommonBusinessId();
//增加操作
UserUtil.setCurrentPersistOperation(${table.entityName?uncap_first});
int line = ${table.entityName?uncap_first}Repository.insertSelective(${table.entityName?uncap_first}Repository);
log.info(UserUtil.getUserInfoProp(${table.entityName?uncap_first}.getToken(),UserUtil.USER_USERNAME)+"新增了ID为"+
${table.entityName?uncap_first}.getBusinessId()+"的信息");
return new PersistModel(line);
}
/**
* 逻辑删除
* @param id
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
PersistModel remove(${table.entityName} ${table.entityName?uncap_first}){
UserUtil.setCurrentMergeOperation(${table.entityName?uncap_first});
int line = ${table.entityName?uncap_first}Repository.logicalDelete(${table.entityName?uncap_first});
log.info(UserUtil.getUserInfoProp(${table.entityName?uncap_first}.getToken(),UserUtil.USER_USERNAME)+"逻辑删除了ID为"+
${table.entityName?uncap_first}.getBusinessId()+"的信息");
return new PersistModel(line);
}
/**
* 修改 ${table.entityName?uncap_first}
* @param ${table.entityName?uncap_first}
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
PersistModel merge(${table.entityName} ${table.entityName?uncap_first}){
UserUtil.setCurrentMergeOperation(${table.entityName?uncap_first});
int line = ${table.entityName?uncap_first}Repository.updateByPrimaryKeySelective(${table.entityName?uncap_first});
log.info(UserUtil.getUserInfoProp(${table.entityName?uncap_first}.getToken(),UserUtil.USER_USERNAME)+"修改了ID为"+
${table.entityName?uncap_first}.getBusinessId()+"的信息");
return new PersistModel(line);
}
/**
* 根据id查询 ${table.entityName?uncap_first}
* @param id
* @return
*/
${table.entityName} findById(String id){
return ${table.entityName?uncap_first}Repository.selectByPrimaryKey(id);
}
/**
* 分页查询 ${table.entityName?uncap_first}
* @param id
* @return
*/
List<${table.entityName}> findAllByPagination(PageUtil<${table.entityName}> paginationUtility,
${table.entityName} ${table.entityName?uncap_first}){
return ${table.entityName?uncap_first}Repository.query${table.entityName}s(${table.entityName?uncap_first});
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment