Commit 42eae64e by duanhq

角色列表bug修复 by duanht 2019/2/28

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@17980 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent 61596dd9
......@@ -40,6 +40,7 @@ import com.glsx.usercenter.service.SysRoleService;
*/
@RestController
@RequestMapping(value = "/role")
@AuthCheck
public class SysRoleController extends BaseController {
@Autowired
......@@ -57,7 +58,7 @@ public class SysRoleController extends BaseController {
public ResultObject getRoleList(Page page, RoleQueryVo roleQueryVo) {
Map<String, Object> result = new HashMap<String, Object>(16);
PageHelper.startPage(page.getPageIndex(), page.getPageSize(), true);
if(roleQueryVo.getId() == null){
if (roleQueryVo.getId() == null) {
roleQueryVo.setId(UserUtils.getUserId(request));
}
List<SysRole> list = sysRoleService.getRoleList(roleQueryVo);
......@@ -89,9 +90,9 @@ public class SysRoleController extends BaseController {
* @Title: saveRole
* @Description: (新增, 编辑)角色
*/
@RequestMapping(value = "/saveRole")
@RequestMapping(value = "/saveRole", method = {RequestMethod.GET, RequestMethod.POST})
@ResponseBody
public ResultObject saveUser(@RequestBody @Validated(value = {Default.class}) SysRole sysRole, BindingResult bindingResult) {
public ResultObject saveUser(@Validated(value = {Default.class}) SysRole sysRole, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
Map<String, String> errorMap = getErrors(bindingResult);
return new ResultObject(ResultCodeEnum.PARAM_ERROR.getCode(), ResultCodeEnum.PARAM_ERROR.getMsg(), errorMap);
......@@ -99,7 +100,7 @@ public class SysRoleController extends BaseController {
SysRole role = sysRoleService.selectByPrimaryKey(sysRole.getId());
if (role == null) {
// 新增角色
if (!sysRoleService.findByRoleName(sysRole.getName()).isEmpty() ) {
if (!sysRoleService.findByRoleName(sysRole.getName()).isEmpty()) {
return new ResultObject(ResultCodeEnum.FAIL.getCode(), "角色信息已存在");
}
sysRole.setCreateTime(DateUtil.getCurrentTime());
......
......@@ -45,7 +45,7 @@ public class SysRole extends BaseModel {
* 角色状态
*/
@NotNull(message="{param.not.null}", groups={Default.class, GroupA.class})
private Integer roleStatus;
private String roleStatus;
/**
* 菜单id
......@@ -90,15 +90,15 @@ public class SysRole extends BaseModel {
this.roleRemark = roleRemark == null ? null : roleRemark.trim();
}
public Integer getRoleStatus() {
public String getRoleStatus() {
return roleStatus;
}
public void setRoleStatus(Integer roleStatus) {
public void setRoleStatus(String roleStatus) {
this.roleStatus = roleStatus;
}
public Integer getId() {
public Integer getId() {
return id;
}
......
......@@ -444,52 +444,52 @@ public class SysRoleExample {
return (Criteria) this;
}
public Criteria andRoleStatusEqualTo(Integer value) {
public Criteria andRoleStatusEqualTo(String value) {
addCriterion("role_status =", value, "roleStatus");
return (Criteria) this;
}
public Criteria andRoleStatusNotEqualTo(Integer value) {
public Criteria andRoleStatusNotEqualTo(String value) {
addCriterion("role_status <>", value, "roleStatus");
return (Criteria) this;
}
public Criteria andRoleStatusGreaterThan(Integer value) {
public Criteria andRoleStatusGreaterThan(String value) {
addCriterion("role_status >", value, "roleStatus");
return (Criteria) this;
}
public Criteria andRoleStatusGreaterThanOrEqualTo(Integer value) {
public Criteria andRoleStatusGreaterThanOrEqualTo(String value) {
addCriterion("role_status >=", value, "roleStatus");
return (Criteria) this;
}
public Criteria andRoleStatusLessThan(Integer value) {
public Criteria andRoleStatusLessThan(String value) {
addCriterion("role_status <", value, "roleStatus");
return (Criteria) this;
}
public Criteria andRoleStatusLessThanOrEqualTo(Integer value) {
public Criteria andRoleStatusLessThanOrEqualTo(String value) {
addCriterion("role_status <=", value, "roleStatus");
return (Criteria) this;
}
public Criteria andRoleStatusIn(List<Integer> values) {
public Criteria andRoleStatusIn(List<String> values) {
addCriterion("role_status in", values, "roleStatus");
return (Criteria) this;
}
public Criteria andRoleStatusNotIn(List<Integer> values) {
public Criteria andRoleStatusNotIn(List<String> values) {
addCriterion("role_status not in", values, "roleStatus");
return (Criteria) this;
}
public Criteria andRoleStatusBetween(Integer value1, Integer value2) {
public Criteria andRoleStatusBetween(String value1, String value2) {
addCriterion("role_status between", value1, value2, "roleStatus");
return (Criteria) this;
}
public Criteria andRoleStatusNotBetween(Integer value1, Integer value2) {
public Criteria andRoleStatusNotBetween(String value1, String value2) {
addCriterion("role_status not between", value1, value2, "roleStatus");
return (Criteria) this;
}
......
......@@ -18,7 +18,7 @@ public class RoleQueryVo extends BaseQueryVo{
/**
* 状态
*/
private Integer roleStatus;
private String roleStatus;
/**
* 权限字符
......@@ -33,11 +33,11 @@ public class RoleQueryVo extends BaseQueryVo{
this.name = name;
}
public Integer getRoleStatus() {
public String getRoleStatus() {
return roleStatus;
}
public void setRoleStatus(Integer roleStatus) {
public void setRoleStatus(String roleStatus) {
this.roleStatus = roleStatus;
}
......
......@@ -3,13 +3,10 @@ package com.glsx.usercenter.service.impl;
import java.util.ArrayList;
import java.util.List;
import javax.validation.Valid;
import com.glsx.usercenter.constants.Constants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.glsx.common.utils.DateUtil;
import com.glsx.common.utils.StringUtils;
import com.glsx.usercenter.mapper.SysRoleMapper;
import com.glsx.usercenter.mapper.SysRoleMenuMapper;
......@@ -61,7 +58,7 @@ public class SysRoleServiceImpl implements SysRoleService {
if (roleQueryVo.getRoleStatus() != null) {
criteria.andRoleStatusEqualTo(roleQueryVo.getRoleStatus());
} else {
criteria.andRoleStatusNotEqualTo(2);
criteria.andRoleStatusNotEqualTo(Constants.SYS_USER_STATUS_LOGOUT);
}
if (StringUtils.isNotEmpty(roleQueryVo.getPermissionCharacter())) {
......@@ -83,7 +80,7 @@ public class SysRoleServiceImpl implements SysRoleService {
public List<SysRole> getAllRole() {
SysRoleExample sysRoleExample = new SysRoleExample();
SysRoleExample.Criteria criteria = sysRoleExample.createCriteria();
criteria.andRoleStatusEqualTo(1);
criteria.andRoleStatusEqualTo(Constants.SYS_USER_STATUS_NORMAL);
return sysRoleMapper.selectByExample(sysRoleExample);
}
......
......@@ -7,7 +7,7 @@
<result column="permission_character" jdbcType="VARCHAR" property="permissionCharacter"/>
<result column="sort" jdbcType="INTEGER" property="sort"/>
<result column="role_remark" jdbcType="VARCHAR" property="roleRemark"/>
<result column="role_status" jdbcType="TINYINT" property="roleStatus"/>
<result column="role_status" jdbcType="VARCHAR" property="roleStatus"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
......@@ -117,7 +117,7 @@
create_time, update_by, update_time
)
values (#{name,jdbcType=VARCHAR}, #{permissionCharacter,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER},
#{roleRemark,jdbcType=VARCHAR}, #{roleStatus,jdbcType=TINYINT}, #{createBy,jdbcType=VARCHAR},
#{roleRemark,jdbcType=VARCHAR}, #{roleStatus,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
......@@ -205,7 +205,7 @@
role_remark = #{record.roleRemark,jdbcType=VARCHAR},
</if>
<if test="record.roleStatus != null">
role_status = #{record.roleStatus,jdbcType=TINYINT},
role_status = #{record.roleStatus,jdbcType=VARCHAR},
</if>
<if test="record.createBy != null">
create_by = #{record.createBy,jdbcType=VARCHAR},
......@@ -231,7 +231,7 @@
permission_character = #{record.permissionCharacter,jdbcType=VARCHAR},
sort = #{record.sort,jdbcType=INTEGER},
role_remark = #{record.roleRemark,jdbcType=VARCHAR},
role_status = #{record.roleStatus,jdbcType=TINYINT},
role_status = #{record.roleStatus,jdbcType=VARCHAR},
create_by = #{record.createBy,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_by = #{record.updateBy,jdbcType=VARCHAR},
......@@ -256,7 +256,7 @@
role_remark = #{roleRemark,jdbcType=VARCHAR},
</if>
<if test="roleStatus != null">
role_status = #{roleStatus,jdbcType=TINYINT},
role_status = #{roleStatus,jdbcType=VARCHAR},
</if>
<if test="createBy != null">
create_by = #{createBy,jdbcType=VARCHAR},
......@@ -279,7 +279,7 @@
permission_character = #{permissionCharacter,jdbcType=VARCHAR},
sort = #{sort,jdbcType=INTEGER},
role_remark = #{roleRemark,jdbcType=VARCHAR},
role_status = #{roleStatus,jdbcType=TINYINT},
role_status = #{roleStatus,jdbcType=VARCHAR},
create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_by = #{updateBy,jdbcType=VARCHAR},
......@@ -289,7 +289,7 @@
<update id="deleteRoleById" parameterType="com.glsx.usercenter.pojo.vo.RoleQueryVo">
update sys_role
set role_status = 2,update_by= #{name,jdbcType=VARCHAR},update_time= #{time,jdbcType=TIMESTAMP}
set role_status = 'sys_user_status_logout',update_by= #{name,jdbcType=VARCHAR},update_time= #{time,jdbcType=TIMESTAMP}
where id in
<foreach collection="ids" index="index" item="id"
separator="," open="(" close=")">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!