fwq
2024-09-27 932bb2fc449ec0774db8b52163e86e4cbf612198
提交 | 用户 | age
826b66 1 package ${serviceImpPack};
C 2
3 import javax.annotation.Resource;
4
5 import org.springframework.stereotype.Service;
6 import org.springframework.transaction.annotation.Transactional;
7
8 import com.hx.exception.TipsException;
9 import ${daoPack}.${classNameUP}Mapper;
10 import ${packageName}.${classNameUP};
11 import ${servicePack}.${classNameUP}Service;
12 import com.hx.mybatisTool.SqlSentence;
13 import java.util.List;
14 import java.util.Map;
15
16 @Transactional
17 @Service
18 public class ${classNameUP}ServiceImpl implements ${classNameUP}Service {
19
20     @Resource
21     private ${classNameUP}Mapper ${className}Mapper;
22
23     /**查询列表*/
24     @Override
25     public List<${classNameUP}> selectList(SqlSentence sqlSentence) {
26         return ${className}Mapper.selectList(sqlSentence);
27     }
28
29     /**查询列表*/
30     @Override
31     public List<Map<String,Object>> selectListMap(SqlSentence sqlSentence) {
32         return ${className}Mapper.selectListMap(sqlSentence);
33     }
34
35     /**查询单个*/
36     @Override
37     public ${classNameUP} selectOne(SqlSentence sqlSentence) {
38         return ${className}Mapper.selectOne(sqlSentence);
39     }
40
41     /**查询单个*/
42     @Override
43     public Map<String,Object> selectOneMap(SqlSentence sqlSentence) {
44         return ${className}Mapper.selectOneMap(sqlSentence);
45     }
46
47     /**查询单个,大数据不拿取*/
48     @Override
49     public ${classNameUP} selectOneByKey(Object object) {
50         return ${className}Mapper.selectOneByKey(object);
51     }
52
53     /**查询单个,大数据拿取*/
54     @Override
55     public ${classNameUP} selectOneByKeyBlob(Object object) {
56         return ${className}Mapper.selectOneByKeyBlob(object);
57     }
58
59     /**新增*/
60     @Override
61     public void insert(${classNameUP} ${className}) {
62         int count = ${className}Mapper.insert(${className});
63         if(count != 1) {
64             throw new TipsException("新增失败!");
65         }
66     }
67
68     /**修改*/
69     @Override
70     public void updateAll(${classNameUP} ${className}) {
71         int count = ${className}Mapper.updateAll(${className});
72         if(count!=1) {
73             throw new TipsException("保存失败!");
74         }
75     }
76
77     /**修改*/
78     @Override
79     public void updateWhere(SqlSentence sqlSentence) {
80         int count = ${className}Mapper.updateWhere(sqlSentence);
81         if(count!=1) {
82             throw new TipsException("保存失败!");
83         }
84     }
85     
86     /**删除一个*/
87     @Override
88     public void deleteOne(String delId) {
89         int count = ${className}Mapper.deleteById(delId);
90         if(count!=1) {
91             throw new TipsException("删除失败!");
92         }
93     }
94
95     /**查询条数*/
96     @Override
97     public int selectCount(SqlSentence sqlSentence) {
98         int count = ${className}Mapper.selectCount(sqlSentence);
99         return count;
100     }
101 }