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 ; /** 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> 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 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