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