From d4f9e73dc6f275a44b45afa13b5af4bf45cae073 Mon Sep 17 00:00:00 2001 From: mg <maokecheng@163.com> Date: 星期五, 28 十月 2022 11:10:19 +0800 Subject: [PATCH] 用戶表刪除部门Id逻辑修改 --- ycl-common/src/main/java/com/ycl/service/user/impl/UmsAdminServiceImpl.java | 27 ++----------- ycl-platform/src/main/resources/mapper/caseHandler/BaseCaseMapper.xml | 2 ycl-common/src/main/java/com/ycl/mapper/user/UmsAdminMapper.java | 4 ++ ycl-common/src/main/resources/mapper/user/UmsAdminMapper.xml | 64 +++++++++++++++++++++++++++++++ ycl-platform/src/main/resources/mapper/caseHandler/ViolationsMapper.xml | 6 +- ycl-common/src/main/java/com/ycl/entity/user/UmsAdmin.java | 9 ++-- ycl-platform/src/main/resources/mapper/caseHandler/PartyInfoMapper.xml | 6 +- 7 files changed, 84 insertions(+), 34 deletions(-) diff --git a/ycl-common/src/main/java/com/ycl/entity/user/UmsAdmin.java b/ycl-common/src/main/java/com/ycl/entity/user/UmsAdmin.java index ed0eee0..f87c644 100644 --- a/ycl-common/src/main/java/com/ycl/entity/user/UmsAdmin.java +++ b/ycl-common/src/main/java/com/ycl/entity/user/UmsAdmin.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.ycl.entity.depart.UmsDepart; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.*; @@ -75,9 +76,6 @@ @ApiModelProperty(value = "鑱屽姟") private String jobTitle; - @ApiModelProperty(value = "閮ㄩ棬id") - private Long departmentId; - @ApiModelProperty(value = "閮ㄩ棬鍚嶇О") @TableField(exist = false) private String departName; @@ -94,8 +92,11 @@ @ApiModelProperty(value = "鏄惁涓虹綉鏍肩鐞嗗憳锛�0->涓嶆槸锛�1->鏄�") private Integer isGrid; - + @ApiModelProperty(value = "瑙掕壊鍒楄〃") + @TableField(exist = false) + private UmsDepart depart; @ApiModelProperty(value = "瑙掕壊鍒楄〃") @TableField(exist = false) private List<UmsRole> roles; + } diff --git a/ycl-common/src/main/java/com/ycl/mapper/user/UmsAdminMapper.java b/ycl-common/src/main/java/com/ycl/mapper/user/UmsAdminMapper.java index 13224f1..0fcda1c 100644 --- a/ycl-common/src/main/java/com/ycl/mapper/user/UmsAdminMapper.java +++ b/ycl-common/src/main/java/com/ycl/mapper/user/UmsAdminMapper.java @@ -1,7 +1,9 @@ package com.ycl.mapper.user; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ycl.entity.user.UmsAdmin; +import com.ycl.vo.user.UserVO; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -21,4 +23,6 @@ */ List<Long> getAdminIdList(@Param("resourceId") Long resourceId); + Page<UmsAdmin> selectCondPage(@Param("page") Page<UmsAdmin> page, @Param("umsAdmin") UserVO.PageUserVO pageUserVO); + } diff --git a/ycl-common/src/main/java/com/ycl/service/user/impl/UmsAdminServiceImpl.java b/ycl-common/src/main/java/com/ycl/service/user/impl/UmsAdminServiceImpl.java index 83b2858..7664f29 100644 --- a/ycl-common/src/main/java/com/ycl/service/user/impl/UmsAdminServiceImpl.java +++ b/ycl-common/src/main/java/com/ycl/service/user/impl/UmsAdminServiceImpl.java @@ -10,7 +10,6 @@ import com.ycl.bo.AdminUserDetails; import com.ycl.dto.UmsAdminParam; import com.ycl.dto.UpdateAdminPasswordParam; -import com.ycl.entity.depart.UmsDepart; import com.ycl.entity.user.*; import com.ycl.exception.ApiException; import com.ycl.exception.Asserts; @@ -24,10 +23,8 @@ import com.ycl.utils.SpringUtil; import com.ycl.utils.common.LiveTimeMillisecond; import com.ycl.utils.common.MacUtils; -import com.ycl.utils.common.PojoUtils; import com.ycl.utils.redis.RedisKey; import com.ycl.vo.user.UserVO; -import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; @@ -159,7 +156,7 @@ //娣诲姞閮ㄩ棬 UmsDepartManage departManage = new UmsDepartManage(); departManage.setUserId(umsAdmin.getId()); - departManage.setDepartId(umsAdmin.getDepartmentId()); + departManage.setDepartId(umsAdminParam.getDepartmentId()); departManage.setCreateTime(new Date()); departManage.setUpdateTime(new Date()); umsDepartManageMapper.insert(departManage); @@ -349,7 +346,7 @@ int pageSize = pageUserVO.getPageSize(); int current = pageUserVO.getCurrent(); Page<UmsAdmin> page = new Page<>(current, pageSize); - LambdaQueryWrapper<UmsAdmin> queryWrapper = new LambdaQueryWrapper<>(); + /* LambdaQueryWrapper<UmsAdmin> queryWrapper = new LambdaQueryWrapper<>(); if (StringUtils.isNotBlank(pageUserVO.getKeyword())) { queryWrapper.like(UmsAdmin::getUsername, pageUserVO.getKeyword()) @@ -361,23 +358,9 @@ } if (PojoUtils.Vo.isUsefulSearchParam(pageUserVO.getUserType())) { queryWrapper.eq(UmsAdmin::getUserType, pageUserVO.getUserType()); - } - if (PojoUtils.Vo.isUsefulSearchParam(pageUserVO.getDepartmentId())) { - queryWrapper.eq(UmsAdmin::getDepartmentId, pageUserVO.getDepartmentId()); - } - Page<UmsAdmin> page1 = baseMapper.selectPage(page, queryWrapper); - List<UmsAdmin> records = page1.getRecords(); - if (CollUtil.isNotEmpty(records)) { - records.forEach(e -> { - UmsDepart umsDepart = departService.getById(e.getDepartmentId()); - if (null != umsDepart) { - e.setDepartName(umsDepart.getDepartName()); - } - //鑾峰彇瑙掕壊鍒楄〃 - List<UmsRole> roles = umsRoleMapper.getRoleList(e.getId()); - e.setRoles(roles); - }); - } + }*/ + Page<UmsAdmin> page1 = baseMapper.selectCondPage(page,pageUserVO); + return page1; } diff --git a/ycl-common/src/main/resources/mapper/user/UmsAdminMapper.xml b/ycl-common/src/main/resources/mapper/user/UmsAdminMapper.xml index 5ae33ba..8f02c2e 100644 --- a/ycl-common/src/main/resources/mapper/user/UmsAdminMapper.xml +++ b/ycl-common/src/main/resources/mapper/user/UmsAdminMapper.xml @@ -18,10 +18,31 @@ <result column="ip_address" property="ipAddress"/> <result column="is_dy" property="isDy"/> <result column="job_title" property="jobTitle"/> - <result column="department_id" property="departmentId"/> <result column="user_type" property="userType"/> <result column="zj" property="zj"/> <result column="mobile" property="mobile"/> + </resultMap> + <resultMap type="com.ycl.entity.user.UmsAdmin" id="CondMapResultMap" extends="BaseResultMap"> + <association property="depart" javaType="com.ycl.entity.depart.UmsDepart"> + <id column="depart_id" property="id"/> + <result column="depart_name" property="departName"/> + <result column="depart_des" property="departDes"/> + <result column="depart_type" property="departType"/> + <result column="parent_id" property="parentId"/> + <result column="depart_status" property="status"/> + <result column="depart_create_time" property="createTime"/> + <result column="depart_update_time" property="updateTime"/> + <result column="is_deleted" property="isDeleted"/> + </association> + <collection property="roles" javaType="ArrayList" ofType="com.ycl.entity.user.UmsRole"> + <id column="role_id" property="id" /> + <result column="name" property="name" /> + <result column="description" property="description" /> + <result column="admin_count" property="adminCount" /> + <result column="role_create_time" property="createTime" /> + <result column="role_status" property="status" /> + <result column="sort" property="sort" /> + </collection> </resultMap> <select id="getAdminIdList" resultType="java.lang.Long"> @@ -31,4 +52,45 @@ WHERE rr.resource_id = #{resourceId} </select> + <select id="selectCondPage" parameterType="com.ycl.entity.user.UmsAdmin" resultMap="CondMapResultMap"> + SELECT + ua.*, + ud.id depart_id, + ud.depart_name, + ud.depart_des, + ud.depart_type, + ud.parent_id, + ud.create_time depat_create_time, + ud.update_time depat_update_time, + ud.STATUS depart_status, + ud.is_deleted, + ur.id role_id, + ur.id NAME, + ur.description, + ur.admin_count, + ur.create_time role_create_time, + ur.STATUS role_status, + ur.sort + FROM + ums_admin ua + LEFT JOIN ums_depart_manager udm ON ua.id = udm.user_id + LEFT JOIN ums_depart ud ON udm.depart_id = ud.id + LEFT JOIN ums_admin_role_relation uarr ON ua.id = uarr.admin_id + LEFT JOIN ums_role ur ON uarr.role_id = ur.id + where 1=1 + <if test="umsAdmin.keyword !=null and umsAdmin.keyword =''"> + AND (ua.username LIKE concat('%',#{umsAdmin.keyword,jdbcType=VARCHAR},'%') + or ua.nick_name LIKE concat('%',#{umsAdmin.keyword,jdbcType=VARCHAR},'%') + or ua.mobile ua.nick_name LIKE concat('%',#{umsAdmin.keyword,jdbcType=VARCHAR},'%')) + </if> + <if test="umsAdmin.userType !=null and umsAdmin.userType >=0 "> + AND ua.user_type = #{umsAdmin.userType} + </if> + <if test="umsAdmin.jobTitle !=null and umsAdmin.jobTitle=''"> + AND ua.job_title = #{umsAdmin.jobTitle} + </if> + ORDER BY + ua.id DESC + </select> + </mapper> diff --git a/ycl-platform/src/main/resources/mapper/caseHandler/BaseCaseMapper.xml b/ycl-platform/src/main/resources/mapper/caseHandler/BaseCaseMapper.xml index 4ab84c8..80657f5 100644 --- a/ycl-platform/src/main/resources/mapper/caseHandler/BaseCaseMapper.xml +++ b/ycl-platform/src/main/resources/mapper/caseHandler/BaseCaseMapper.xml @@ -116,7 +116,7 @@ usr2.region_name community_text, ua.username create_user_text FROM ums_base_case ubc - LEFT JOIN ums_data_dictionary udd on ubc.category = udd.id and udd.type_code = '01' + LEFT JOIN ums_data_dictionary udd on ubc.category = udd.id LEFT JOIN ums_sccg_region usr on ubc.street_id = usr.id LEFT JOIN ums_sccg_region usr2 on ubc.community_id = usr2.id LEFT JOIN ums_admin ua on ubc.create_user = ua.id diff --git a/ycl-platform/src/main/resources/mapper/caseHandler/PartyInfoMapper.xml b/ycl-platform/src/main/resources/mapper/caseHandler/PartyInfoMapper.xml index ad8472e..561df96 100644 --- a/ycl-platform/src/main/resources/mapper/caseHandler/PartyInfoMapper.xml +++ b/ycl-platform/src/main/resources/mapper/caseHandler/PartyInfoMapper.xml @@ -38,9 +38,9 @@ udd3.name nation_text FROM ums_party_info upi - LEFT JOIN ums_data_dictionary udd on upi.certificate_type = udd.id and udd.type_code = '03' - LEFT JOIN ums_data_dictionary udd2 on upi.education_degree = udd2.id and udd2.type_code = '04' - LEFT JOIN ums_data_dictionary udd3 on upi.nation = udd3.id and udd3.type_code = '05' + LEFT JOIN ums_data_dictionary udd on upi.certificate_type = udd.id + LEFT JOIN ums_data_dictionary udd2 on upi.education_degree = udd2.id + LEFT JOIN ums_data_dictionary udd3 on upi.nation = udd3.id WHERE upi.`id` = #{id} </select> diff --git a/ycl-platform/src/main/resources/mapper/caseHandler/ViolationsMapper.xml b/ycl-platform/src/main/resources/mapper/caseHandler/ViolationsMapper.xml index bc3d42d..ca15c09 100644 --- a/ycl-platform/src/main/resources/mapper/caseHandler/ViolationsMapper.xml +++ b/ycl-platform/src/main/resources/mapper/caseHandler/ViolationsMapper.xml @@ -34,9 +34,9 @@ udd3.name grade_text FROM ums_violations uv - LEFT JOIN ums_data_dictionary udd on uv.category_id = udd.id and udd.type_code = '01' - LEFT JOIN ums_data_dictionary udd2 on uv.type_id = udd2.id and udd2.type_code = '01' - LEFT JOIN ums_data_dictionary udd3 on uv.grade_id = udd3.id and udd3.type_code = '02' + LEFT JOIN ums_data_dictionary udd on uv.category_id = udd.id + LEFT JOIN ums_data_dictionary udd2 on uv.type_id = udd2.id + LEFT JOIN ums_data_dictionary udd3 on uv.grade_id = udd3.id WHERE uv.`id` = #{id} </select> -- Gitblit v1.8.0