Skip to content

Commit

Permalink
修改service.ftl中已经被废弃的变量名
Browse files Browse the repository at this point in the history
  • Loading branch information
superzoc committed Sep 2, 2013
1 parent 67f61bf commit 2f3ed6f
Showing 1 changed file with 55 additions and 55 deletions.
110 changes: 55 additions & 55 deletions src/main/java/com/thinkgem/jeesite/generate/template/service.ftl
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
/**
* There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
*/
package ${packageName}.${moduleName}.service${subModuleName};

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.BaseService;
import com.thinkgem.jeesite.common.utils.StringUtils;
import ${packageName}.${moduleName}.entity${subModuleName}.${ClassName};
import ${packageName}.${moduleName}.dao${subModuleName}.${ClassName}Dao;

/**
* ${functionName}Service
* @author ${classAuthor}
* @version ${classVersion}
*/
@Component
@Transactional(readOnly = true)
public class ${ClassName}Service extends BaseService {

@Autowired
private ${ClassName}Dao ${className}Dao;

public ${ClassName} get(Long id) {
return ${className}Dao.get(id);
}

public Page<${ClassName}> find(Page<${ClassName}> page, ${ClassName} ${className}) {
DetachedCriteria dc = ${className}Dao.createDetachedCriteria();
if (StringUtils.isNotEmpty(${className}.getName())){
dc.add(Restrictions.like("name", "%"+${className}.getName()+"%"));
}
dc.add(Restrictions.eq(${ClassName}.DEL_FLAG, ${ClassName}.DEL_FLAG_NORMAL));
dc.addOrder(Order.desc("id"));
return ${className}Dao.find(page, dc);
}

@Transactional(readOnly = false)
public void save(${ClassName} ${className}) {
${className}Dao.save(${className});
}

@Transactional(readOnly = false)
public void delete(Long id) {
${className}Dao.deleteById(id);
}

}
/**
* There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
*/
package ${packageName}.${moduleName}.service${subModuleName};

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.BaseService;
import com.thinkgem.jeesite.common.utils.StringUtils;
import ${packageName}.${moduleName}.entity${subModuleName}.${ClassName};
import ${packageName}.${moduleName}.dao${subModuleName}.${ClassName}Dao;

/**
* ${functionName}Service
* @author ${classAuthor}
* @version ${classVersion}
*/
@Component
@Transactional(readOnly = true)
public class ${ClassName}Service extends BaseService {

@Autowired
private ${ClassName}Dao ${className}Dao;

public ${ClassName} get(Long id) {
return ${className}Dao.get(id);
}

public Page<${ClassName}> find(Page<${ClassName}> page, ${ClassName} ${className}) {
DetachedCriteria dc = ${className}Dao.createDetachedCriteria();
if (StringUtils.isNotEmpty(${className}.getName())){
dc.add(Restrictions.like("name", "%"+${className}.getName()+"%"));
}
dc.add(Restrictions.eq(${ClassName}.FIELD_DEL_FLAG, ${ClassName}.DEL_FLAG_NORMAL));
dc.addOrder(Order.desc("id"));
return ${className}Dao.find(page, dc);
}

@Transactional(readOnly = false)
public void save(${ClassName} ${className}) {
${className}Dao.save(${className});
}

@Transactional(readOnly = false)
public void delete(Long id) {
${className}Dao.deleteById(id);
}

}

0 comments on commit 2f3ed6f

Please sign in to comment.