修改完善CRUD
This commit is contained in:
parent
abf7bf9bda
commit
33b7cd630c
@ -9,18 +9,20 @@ import lombok.Data;
|
||||
public class AdminUserListRespVO {
|
||||
@ApiModelProperty(value = "id")
|
||||
private String id;
|
||||
@ApiModelProperty(value = "员工ID")
|
||||
private String staffId;
|
||||
@ApiModelProperty(value = "员工姓名")
|
||||
private String staffName;
|
||||
@ApiModelProperty(value = "昵称")
|
||||
private String name;
|
||||
// @ApiModelProperty(value = "员工ID")
|
||||
// private String staffId;
|
||||
// @ApiModelProperty(value = "员工姓名")
|
||||
// private String staffName;
|
||||
@ApiModelProperty(value = "手机号")
|
||||
private String phone;
|
||||
@ApiModelProperty(value = "工号")
|
||||
private String jobNo;
|
||||
@ApiModelProperty(value = "组织")
|
||||
private String companyName;
|
||||
@ApiModelProperty(value = "组织ID")
|
||||
private String companyId;
|
||||
// @ApiModelProperty(value = "工号")
|
||||
// private String jobNo;
|
||||
// @ApiModelProperty(value = "组织")
|
||||
// private String companyName;
|
||||
// @ApiModelProperty(value = "组织ID")
|
||||
// private String companyId;
|
||||
@ApiModelProperty(value = "角色")
|
||||
private String roleName;
|
||||
@ApiModelProperty(value = "角色ID")
|
||||
|
@ -11,8 +11,8 @@ public class AddOrUpdateRoleReqVO {
|
||||
private String id;
|
||||
@ApiModelProperty(value = "角色名称")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "0系统角色 1业务角色")
|
||||
private Integer type;
|
||||
// @ApiModelProperty(value = "0系统角色 1业务角色")
|
||||
// private Integer type;
|
||||
@ApiModelProperty(value = "菜单ID列表")
|
||||
private List<Integer> menuIdList;
|
||||
|
||||
|
@ -10,6 +10,6 @@ import lombok.Data;
|
||||
public class RoleListReqVO extends BaseQueryParameterReq {
|
||||
@ApiModelProperty(value = "名字")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "0系统角色 1业务角色")
|
||||
private Integer type;
|
||||
// @ApiModelProperty(value = "0系统角色 1业务角色")
|
||||
// private Integer type;
|
||||
}
|
||||
|
@ -60,8 +60,8 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
String id = addOrUpdateAdminUserReqVO.getId();
|
||||
if (StringUtils.isBlank(id)) {
|
||||
addOrUpdateAdminUserReqVO.setId(SnowFlakeUtil.getId());
|
||||
String password = addOrUpdateAdminUserReqVO.getPassword();
|
||||
addOrUpdateAdminUserReqVO.setPassword(password);
|
||||
// String password = addOrUpdateAdminUserReqVO.getPassword();
|
||||
// addOrUpdateAdminUserReqVO.setPassword(password);
|
||||
int add = adminUserMapper.add(addOrUpdateAdminUserReqVO);
|
||||
if (add > 0) {
|
||||
return ApiResponse.buildSuccessResponse(null);
|
||||
|
@ -37,9 +37,9 @@ public class RoleServiceImpl implements RoleService {
|
||||
@Override
|
||||
public ApiResponse list(RoleListReqVO roleListReqVO) {
|
||||
PageHelper.startPage(roleListReqVO.getPage(),roleListReqVO.getPageSize());
|
||||
if(roleListReqVO.getType()==null){
|
||||
roleListReqVO.setType(0);
|
||||
}
|
||||
// if(roleListReqVO.getType()==null){
|
||||
// roleListReqVO.setType(0);
|
||||
// }
|
||||
List<RoleListRespVO> list = roleMapper.list(roleListReqVO);
|
||||
PageInfo<RoleListRespVO> pageInfo = new PageInfo(list);
|
||||
return ApiResponse.buildSuccessResponse(pageInfo);
|
||||
@ -52,7 +52,9 @@ public class RoleServiceImpl implements RoleService {
|
||||
String roleId = SnowFlakeUtil.getId();
|
||||
addOrUpdateRoleReqVO.setId(roleId);
|
||||
if(roleMapper.add(addOrUpdateRoleReqVO)>0){
|
||||
if(addOrUpdateRoleReqVO.getMenuIdList()!=null&addOrUpdateRoleReqVO.getMenuIdList().size()>0) {
|
||||
menuMapper.addRoleMenu(roleId, addOrUpdateRoleReqVO.getMenuIdList());
|
||||
}
|
||||
return ApiResponse.buildSuccessResponse(null);
|
||||
}
|
||||
}else {
|
||||
|
@ -4,19 +4,17 @@
|
||||
<insert id="add" parameterType="com.ycwl.basic.model.pc.adminUser.req.AddOrUpdateAdminUserReqVO">
|
||||
insert into admin_user(`id`,
|
||||
`role_id`,
|
||||
`staff_id`,
|
||||
`account`,
|
||||
`password`)
|
||||
values (#{id},
|
||||
#{roleId},
|
||||
#{staffId},
|
||||
#{account},
|
||||
#{password})
|
||||
</insert>
|
||||
<update id="delete">
|
||||
update
|
||||
admin_user
|
||||
set is_remove=1
|
||||
set status=0
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
@ -29,59 +27,41 @@
|
||||
|
||||
<update id="update" parameterType="com.ycwl.basic.model.pc.adminUser.req.AddOrUpdateAdminUserReqVO">
|
||||
update admin_user
|
||||
set `role_id` =#{roleId},
|
||||
`staff_id` =#{staffId}
|
||||
set `role_id` =#{roleId}
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="updatePassword">
|
||||
update
|
||||
admin_user
|
||||
set password=#{newPwd}
|
||||
where staff_id = #{id}
|
||||
and is_remove = 0
|
||||
where id = #{id}
|
||||
and status = 1
|
||||
</update>
|
||||
|
||||
<select id="list" parameterType="com.ycwl.basic.model.pc.adminUser.req.AdminUserListReqVO"
|
||||
resultType="com.ycwl.basic.model.pc.adminUser.resp.AdminUserListRespVO">
|
||||
select
|
||||
s.id as staffId,
|
||||
au.id,
|
||||
s.phone,
|
||||
s.name as staffName,
|
||||
s.job_no,
|
||||
c.name as companyName,
|
||||
s.company_id,
|
||||
au.phone,
|
||||
au.name,
|
||||
r.id as roleId,
|
||||
r.name as roleName
|
||||
from admin_user au,
|
||||
staff s,
|
||||
company c,
|
||||
role r
|
||||
where au.staff_id = s.id
|
||||
and au.is_remove=0
|
||||
where au.status=1
|
||||
and au.role_id = r.id
|
||||
and s.company_id = c.id
|
||||
and s.is_remove=0
|
||||
<if test="name!=null and name!=''">
|
||||
and
|
||||
locate(#{name},s.`name`) > 0
|
||||
locate(#{name},au.`name`) > 0
|
||||
</if>
|
||||
<if test="phone!=null and phone!=''">
|
||||
and
|
||||
locate(#{phone},s.`phone`) > 0
|
||||
</if>
|
||||
<if test="jobNo!=null and jobNo!=''">
|
||||
and
|
||||
locate(#{jobNo},s.`job_no`) > 0
|
||||
locate(#{phone},au.`phone`) > 0
|
||||
</if>
|
||||
<if test="roleId!=null and roleId!=''">
|
||||
and
|
||||
r.id=#{roleId}
|
||||
</if>
|
||||
<if test="companyId!=null and companyId!=''">
|
||||
and
|
||||
s.company_id=#{companyId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="login" resultType="com.ycwl.basic.model.pc.adminUser.entity.LoginEntity">
|
||||
@ -91,13 +71,13 @@
|
||||
au.role_id
|
||||
from admin_user au
|
||||
where account = #{account}
|
||||
and au.is_remove = 0
|
||||
and au.status = 1
|
||||
</select>
|
||||
|
||||
<select id="getPasswordByAccount" resultType="java.lang.String">
|
||||
select `password`
|
||||
from admin_user
|
||||
where staff_id = #{id}
|
||||
and is_remove = 0
|
||||
where id = #{id}
|
||||
and status = 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -2,8 +2,8 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ycwl.basic.mapper.pc.RoleMapper">
|
||||
<insert id="add" parameterType="com.ycwl.basic.model.pc.role.req.AddOrUpdateRoleReqVO">
|
||||
insert into role(`id`, `name`, `type`)
|
||||
values (#{id}, #{name}, #{type})
|
||||
insert into role(`id`, `name`)
|
||||
values (#{id}, #{name})
|
||||
</insert>
|
||||
|
||||
<update id="delete">
|
||||
@ -30,8 +30,6 @@
|
||||
role
|
||||
where
|
||||
is_remove=0
|
||||
and
|
||||
`type`=#{type}
|
||||
<if test="name!=null and name!=''">
|
||||
and
|
||||
locate(#{name},`name`) > 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user