ChenJiaHe
2020-10-16 3fde78070037d46fb2af7240de41b47a8c3fab4a
提交 | 用户 | age
3fde78 1 package com.hx.common.service.impl;
C 2
3 import com.hx.common.dao.CommonDao;
4 import com.hx.common.service.CommonService;
5 import com.hx.mybatisTool.SqlParam;
6 import com.hx.mybatisTool.SqlSentence;
7 import org.springframework.stereotype.Service;
8 import org.springframework.transaction.annotation.Transactional;
9
10 import javax.annotation.Resource;
11 import java.io.Serializable;
12 import java.util.List;
13 import java.util.Map;
14
15 /**当前是有事务处理*/
16 @Transactional
17 @Service
18 public class CommonServiceImpl implements CommonService {
19
20     @Resource
21     private CommonDao commonDao;
22
23     /**插入*/
24     @Override
25     public <T extends Serializable> int insert(Class<?> mapperClass,T entity) {
26         return commonDao.insert(mapperClass,entity);
27     }
28
29     /**获取条数*/
30     @Override
31     public <T extends Serializable> int selectCount(Class<?> mapperClass,SqlParam sqlParam) {
32         return commonDao.selectCount(mapperClass,sqlParam);
33     }
34
35     /**获取列表*/
36     @Override
37     public <T extends Serializable> List<T> selectList(Class<?> mapperClass, SqlSentence sqlSentence) {
38         return commonDao.selectList(mapperClass,sqlSentence);
39     }
40
41     /**获取列表*/
42     @Override
43     public <T extends Serializable> List<Map<String, Object>> selectListMap(Class<?> mapperClass, SqlSentence sqlSentence) {
44         return commonDao.selectListMap(mapperClass,sqlSentence);
45     }
46
47     /**获取单条数据*/
48     @Override
49     public <T extends Serializable> T selectOne(Class<?> mapperClass, SqlSentence sqlSentence) {
50         return commonDao.selectOne(mapperClass,sqlSentence);
51     }
52
53     /**获取单条数据*/
54     @Override
55     public <T extends Serializable> Map<String, Object> selectOneMap(Class<?> mapperClass, SqlSentence sqlSentence) {
56         return commonDao.selectOneMap(mapperClass,sqlSentence);
57     }
58
59     /**获取单条数据-不含longText的数据*/
60     @Override
61     public <T extends Serializable> T selectOneByKey(Class<?> mapperClass,Object object) {
62         return commonDao.selectOneByKey(mapperClass,object);
63     }
64
65     /**获取单条数据-含longText的数据*/
66     @Override
67     public <T extends Serializable> T selectOneByKeyBlob(Class<?> mapperClass,Object object) {
68         return commonDao.selectOneByKeyBlob(mapperClass,object);
69     }
70
71     /**更新*/
72     @Override
73     public <T extends Serializable> int updateWhere(Class<?> mapperClass,SqlParam sqlParam) {
74         return commonDao.updateWhere(mapperClass,sqlParam);
75     }
76
77     /**全部字段更新*/
78     @Override
79     public <T extends Serializable> int updateAll(Class<?> mapperClass,T entity) {
80         return commonDao.updateAll(mapperClass,entity);
81     }
82
83     /**删除*/
84     @Override
85     public <T extends Serializable> int deleteWhere(Class<?> mapperClass,SqlParam sqlParam) {
86         return commonDao.deleteWhere(mapperClass,sqlParam);
87     }
88
89     /**删除*/
90     @Override
91     public <T extends Serializable> int deleteById(Class<?> mapperClass,Object object) {
92         return commonDao.deleteById(mapperClass,object);
93     }
94
95 }