package com.hx.other.service.service.impl;
|
|
import javax.annotation.Resource;
|
|
import org.springframework.stereotype.Service;
|
import org.springframework.transaction.annotation.Transactional;
|
|
import com.hx.exception.TipsException;
|
import com.hx.other.service.dao.mapper.UserMapper;
|
import com.hx.other.service.model.User;
|
import com.hx.other.service.service.UserService;
|
import com.hx.mybatisTool.SqlSentence;
|
import java.util.List;
|
import java.util.Map;
|
|
@Transactional
|
@Service
|
public class UserServiceImpl implements UserService {
|
|
@Resource
|
private UserMapper userMapper;
|
|
/**查询列表*/
|
@Override
|
public List<User> selectList(SqlSentence sqlSentence) {
|
return userMapper.selectList(sqlSentence);
|
}
|
|
/**查询列表*/
|
@Override
|
public List<Map<String,Object>> selectListMap(SqlSentence sqlSentence) {
|
return userMapper.selectListMap(sqlSentence);
|
}
|
|
/**查询单个*/
|
@Override
|
public User selectOne(SqlSentence sqlSentence) {
|
return userMapper.selectOne(sqlSentence);
|
}
|
|
/**查询单个*/
|
@Override
|
public Map<String,Object> selectOneMap(SqlSentence sqlSentence) {
|
return userMapper.selectOneMap(sqlSentence);
|
}
|
|
/**查询单个,大数据不拿取*/
|
@Override
|
public User selectOneByKey(Object object) {
|
return userMapper.selectOneByKey(object);
|
}
|
|
/**查询单个,大数据拿取*/
|
@Override
|
public User selectOneByKeyBlob(Object object) {
|
return userMapper.selectOneByKeyBlob(object);
|
}
|
|
/**新增*/
|
@Override
|
public void insert(User user) {
|
int count = userMapper.insert(user);
|
if(count != 1) {
|
throw new TipsException("新增失败!");
|
}
|
}
|
|
/**修改*/
|
@Override
|
public void updateAll(User user) {
|
int count = userMapper.updateAll(user);
|
if(count!=1) {
|
throw new TipsException("保存失败!");
|
}
|
}
|
|
/**修改*/
|
@Override
|
public void updateWhere(SqlSentence sqlSentence) {
|
int count = userMapper.updateWhere(sqlSentence);
|
if(count!=1) {
|
throw new TipsException("保存失败!");
|
}
|
}
|
|
/**删除一个*/
|
@Override
|
public void deleteOne(String delId) {
|
int count = userMapper.deleteById(delId);
|
if(count!=1) {
|
throw new TipsException("删除失败!");
|
}
|
}
|
|
/**查询条数*/
|
@Override
|
public int selectCount(SqlSentence sqlSentence) {
|
int count = userMapper.selectCount(sqlSentence);
|
return count;
|
}
|
}
|