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