From 2661ce7da0b5544d5574cfad50cba9a9a643254c Mon Sep 17 00:00:00 2001 From: liuxm <liuxm@fescotech.com> Date: 星期一, 06 五月 2024 15:47:05 +0800 Subject: [PATCH] 用户管理方法修改 --- pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoBa/BaUser.java | 2 ++ pms-parent/pms-global/src/main/resources/mapper/BaUserMapper.xml | 18 +++++++++++------- pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/user/UserSv.java | 17 ++++++++++++++++- pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/user/UserCtrl.java | 18 ++++++++++++++++++ 4 files changed, 47 insertions(+), 8 deletions(-) diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoBa/BaUser.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoBa/BaUser.java index 38751b5..b9f74d6 100644 --- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoBa/BaUser.java +++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoBa/BaUser.java @@ -78,6 +78,7 @@ /** * 鍒犻櫎鏍囧織锛�1鏄紝0鍚� */ + @JSONField(serialize = false) public Boolean deleted; /** @@ -100,6 +101,7 @@ * 鍓嶇web鐣岄潰鎻愪氦鐨勭敤鎴锋墍灞炶鑹茬殑id锛屽叾鏄竴涓瓧绗︿覆鏁扮粍 */ @TableField(exist = false) + @JSONField(serialize = false) public String[] roleIds ; /** diff --git a/pms-parent/pms-global/src/main/resources/mapper/BaUserMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/BaUserMapper.xml index 6c0c90b..b03de62 100644 --- a/pms-parent/pms-global/src/main/resources/mapper/BaUserMapper.xml +++ b/pms-parent/pms-global/src/main/resources/mapper/BaUserMapper.xml @@ -21,6 +21,7 @@ <result property="phone" column="phone"/> <result property="password" column="password"/> <result property="disabled" column="disabled" typeHandler="com.dy.common.mybatis.BooleanTypeHandler" /> + <result column="create_dt" property="dt" /> </resultMap> <resultMap id="oneResultMap" type="com.dy.pmsGlobal.pojoBa.BaUser" extends="BaseResultMap"> <collection property="roles" fetchType="eager" column="{userId=id}" select="com.dy.pmsGlobal.daoBa.BaRoleMapper.selectByUserId" /> @@ -72,7 +73,7 @@ select count(*) from ba_user bu - left join ba_user_role ur on ur.user_id=bu.id +# left join ba_user_role ur on ur.user_id=bu.id where bu.supper_admin!=1 and bu.deleted!=1 <trim prefix="and" suffixOverrides="and"> <if test="name != null and name != ''"> @@ -81,8 +82,11 @@ <if test="phone != null and phone !=''"> bu.phone = #{phone,jdbcType=VARCHAR} and </if> - <if test="roleId != null"> - ur.role_id=#{roleId,jdbcType=BIGINT} +<!-- <if test="roleId != null">--> +<!-- ur.role_id=#{roleId,jdbcType=BIGINT} and--> +<!-- </if>--> + <if test="disabled != null"> + bu.disabled=#{disabled,jdbcType=BOOLEAN} </if> </trim> </select> @@ -92,7 +96,7 @@ <property name="alias" value="bu"/> </include> from ba_user bu - left join ba_user_role ur on ur.user_id=bu.id +# left join ba_user_role ur on ur.user_id=bu.id where bu.supper_admin!=1 and bu.deleted!=1 <trim prefix="and" suffixOverrides="and"> <if test="name != null and name != ''"> @@ -101,9 +105,9 @@ <if test="phone != null and phone !=''"> bu.phone = #{phone,jdbcType=VARCHAR} and </if> - <if test="roleId != null"> - ur.role_id=#{roleId,jdbcType=BIGINT} and - </if> +<!-- <if test="roleId != null">--> +<!-- ur.role_id=#{roleId,jdbcType=BIGINT} and--> +<!-- </if>--> <if test="disabled != null"> bu.disabled=#{disabled,jdbcType=BOOLEAN} </if> diff --git a/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/user/UserCtrl.java b/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/user/UserCtrl.java index ce93d75..95d9d64 100644 --- a/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/user/UserCtrl.java +++ b/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/user/UserCtrl.java @@ -7,6 +7,7 @@ import com.dy.common.webUtil.BaseResponseUtils; import com.dy.common.webUtil.QueryResultVo; import com.dy.pmsGlobal.aop.Log; +import com.dy.pmsGlobal.pojoBa.BaRole; import com.dy.pmsGlobal.pojoBa.BaUser; import com.dy.pmsGlobal.util.Constant; import com.mysql.cj.util.StringUtils; @@ -166,6 +167,23 @@ } /** + * 绂佺敤鎴栧惎鐢ㄧ敤鎴蜂俊鎭� + * @param po + * @return + */ + @PostMapping(path="disabled") + @SsoPowerAop(power = "10100011") + @Log("绂佺敤鎴栧惎鐢ㄧ敤鎴蜂俊鎭�") + public BaseResponse<BaRole> disabled(@RequestBody BaUser po){ + try { + return BaseResponseUtils.buildSuccess(sv.disabled(po.id,po.disabled)); + }catch (Exception e){ + log.error("绂佺敤鎴栧惎鐢ㄧ敤鎴蜂俊鎭紓甯�", e); + return BaseResponseUtils.buildException(e.getMessage()); + } + } + + /** * 鍒犻櫎鐢ㄦ埛淇℃伅 * @param id * @return diff --git a/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/user/UserSv.java b/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/user/UserSv.java index 753a880..a0ca41c 100644 --- a/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/user/UserSv.java +++ b/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/user/UserSv.java @@ -11,7 +11,9 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.*; +import java.util.List; +import java.util.Map; +import java.util.Random; @Slf4j @Service @@ -98,6 +100,19 @@ } /** + * 绂佺敤鎴栧惎鐢ㄧ敤鎴蜂俊鎭� + * @param id + * @param disabled + * @return + */ + public int disabled(Long id,Boolean disabled) { + BaUser user=new BaUser(); + user.id=id; + user.disabled=disabled; + return dao.updateByPrimaryKeySelective(user); + } + + /** * 淇敼瀵嗙爜 * * @param id 鐢ㄦ埛ID -- Gitblit v1.8.0