|
|
|
@ -6,10 +6,8 @@ import com.jingcheng.cms.mapper.UsersMapper;
|
|
|
|
|
import com.jingcheng.cms.model.PopularLabel;
|
|
|
|
|
import com.jingcheng.cms.model.Users;
|
|
|
|
|
import com.jingcheng.cms.service.UsersService;
|
|
|
|
|
import com.jingcheng.cms.util.AjaxResult;
|
|
|
|
|
import com.jingcheng.cms.util.JWTUtil;
|
|
|
|
|
import com.jingcheng.cms.util.LogUtils;
|
|
|
|
|
import com.jingcheng.cms.util.PageUtils;
|
|
|
|
|
import com.jingcheng.cms.util.*;
|
|
|
|
|
import lombok.SneakyThrows;
|
|
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
|
|
import org.apache.shiro.subject.Subject;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
@ -18,6 +16,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import tk.mybatis.mapper.entity.Example;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
@ -73,8 +72,10 @@ public class UsersServiceImpl implements UsersService {
|
|
|
|
|
return pageJson;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@SneakyThrows
|
|
|
|
|
@Override
|
|
|
|
|
public AjaxResult saveUsers(JSONObject jsonObject) {
|
|
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
|
|
|
|
AjaxResult ajaxResult = new AjaxResult();
|
|
|
|
|
Long id = jsonObject.getLong("id");
|
|
|
|
|
String userName = jsonObject.getString("userName");
|
|
|
|
@ -87,10 +88,14 @@ public class UsersServiceImpl implements UsersService {
|
|
|
|
|
ajaxResult.setRetcode(AjaxResult.FAILED);
|
|
|
|
|
return ajaxResult;
|
|
|
|
|
}else {
|
|
|
|
|
Example example = new Example(Users.class);
|
|
|
|
|
Example.Criteria criteria = example.createCriteria();
|
|
|
|
|
criteria.andEqualTo("id",id);
|
|
|
|
|
users = new Users();
|
|
|
|
|
users.setUserName(userName);
|
|
|
|
|
users.setUserNo(userNo);
|
|
|
|
|
users.setPassword(password);
|
|
|
|
|
usersMapper.updateByPrimaryKeySelective(users);
|
|
|
|
|
usersMapper.updateByExampleSelective(users,example);
|
|
|
|
|
}
|
|
|
|
|
ajaxResult.setRetmsg("成功修改用户");
|
|
|
|
|
}else {
|
|
|
|
@ -116,8 +121,12 @@ public class UsersServiceImpl implements UsersService {
|
|
|
|
|
ajaxResult.setRetcode(AjaxResult.FAILED);
|
|
|
|
|
return ajaxResult;
|
|
|
|
|
}else {
|
|
|
|
|
Example example = new Example(Users.class);
|
|
|
|
|
Example.Criteria criteria = example.createCriteria();
|
|
|
|
|
criteria.andEqualTo("id",id);
|
|
|
|
|
users = new Users();
|
|
|
|
|
users.setState(Constants.DISABLE);
|
|
|
|
|
usersMapper.updateByPrimaryKeySelective(users);
|
|
|
|
|
usersMapper.updateByExampleSelective(users,example);
|
|
|
|
|
ajaxResult.setRetmsg("用户删除成功");
|
|
|
|
|
return ajaxResult;
|
|
|
|
|
}
|
|
|
|
|