ca7ba94d3720bffc64c9b152998ab6dcf0e3da4d.svn-base
1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
* Copyright © 2015-2018 ODM All rights reserved.
*/
package com.thinkgem.jeesite.modules.gen.service;
import org.apache.commons.lang3.StringEscapeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
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 com.thinkgem.jeesite.modules.gen.entity.GenTemplate;
import com.thinkgem.jeesite.modules.gen.dao.GenTemplateDao;
/**
* 代码模板Service
* @author ThinkGem
* @version 2013-10-15
*/
@Service
@Transactional(readOnly = true)
public class GenTemplateService extends BaseService {
@Autowired
private GenTemplateDao genTemplateDao;
public GenTemplate get(String id) {
return genTemplateDao.get(id);
}
public Page<GenTemplate> find(Page<GenTemplate> page, GenTemplate genTemplate) {
genTemplate.setPage(page);
page.setList(genTemplateDao.findList(genTemplate));
return page;
}
@Transactional(readOnly = false)
public void save(GenTemplate genTemplate) {
if (genTemplate.getContent()!=null){
genTemplate.setContent(StringEscapeUtils.unescapeHtml4(genTemplate.getContent()));
}
if (StringUtils.isBlank(genTemplate.getId())){
genTemplate.preInsert();
genTemplateDao.insert(genTemplate);
}else{
genTemplate.preUpdate();
genTemplateDao.update(genTemplate);
}
}
@Transactional(readOnly = false)
public void delete(GenTemplate genTemplate) {
genTemplateDao.delete(genTemplate);
}
}