guang
2023-04-23 9e1c8d19bbca288b74464e90b75c9c1fe710ec1e
提交 | 用户 | age
9e1c8d 1 package com.hx.other.service.service.impl;
G 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 com.hx.other.service.dao.mapper.UserMapper;
10 import com.hx.other.service.model.User;
11 import com.hx.other.service.service.UserService;
12 import com.hx.mybatisTool.SqlSentence;
13 import java.util.List;
14 import java.util.Map;
15
16 @Transactional
17 @Service
18 public class UserServiceImpl implements UserService {
19
20     @Resource
21     private UserMapper userMapper;
22
23     /**查询列表*/
24     @Override
25     public List<User> selectList(SqlSentence sqlSentence) {
26         return userMapper.selectList(sqlSentence);
27     }
28
29     /**查询列表*/
30     @Override
31     public List<Map<String,Object>> selectListMap(SqlSentence sqlSentence) {
32         return userMapper.selectListMap(sqlSentence);
33     }
34
35     /**查询单个*/
36     @Override
37     public User selectOne(SqlSentence sqlSentence) {
38         return userMapper.selectOne(sqlSentence);
39     }
40
41     /**查询单个*/
42     @Override
43     public Map<String,Object> selectOneMap(SqlSentence sqlSentence) {
44         return userMapper.selectOneMap(sqlSentence);
45     }
46
47     /**查询单个,大数据不拿取*/
48     @Override
49     public User selectOneByKey(Object object) {
50         return userMapper.selectOneByKey(object);
51     }
52
53     /**查询单个,大数据拿取*/
54     @Override
55     public User selectOneByKeyBlob(Object object) {
56         return userMapper.selectOneByKeyBlob(object);
57     }
58
59     /**新增*/
60     @Override
61     public void insert(User user) {
62         int count = userMapper.insert(user);
63         if(count != 1) {
64             throw new TipsException("新增失败!");
65         }
66     }
67
68     /**修改*/
69     @Override
70     public void updateAll(User user) {
71         int count = userMapper.updateAll(user);
72         if(count!=1) {
73             throw new TipsException("保存失败!");
74         }
75     }
76
77     /**修改*/
78     @Override
79     public void updateWhere(SqlSentence sqlSentence) {
80         int count = userMapper.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 = userMapper.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 = userMapper.selectCount(sqlSentence);
99         return count;
100     }
101 }