fix:用户代码优化

This commit is contained in:
s2042968 2025-04-21 10:25:41 +08:00
parent 183ac999cb
commit 51caef89ef
3 changed files with 5 additions and 129 deletions

View File

@ -28,7 +28,7 @@ public class UserController {
return userService.login(loginRequest);
}
// @RequiredRole(AdminTypeEnum.SYSTEM)
@RequiredRole(AdminTypeEnum.SYSTEM)
@PostMapping("/createUser")
@UserOperation(value = "新增用户信息", modelName = UserOperationModuleEnum.USER)
public ElectromagneticResult<?> createUser(@RequestBody UserRequest userRequest) {

View File

@ -12,31 +12,6 @@ import java.util.List;
@Mapper
public interface UserMapper extends BaseMapper<User> {
// /**
// * 插入
// *
// * @param user
// * @return
// */
// @Override
// int insert(User user);
//
// /**
// * 编辑
// *
// * @param user
// * @return
// */
// int modify(User user);
// /**
// * 发布
// *
// * @param publishParam
// * @return
// */
// int publish(PublishParam publishParam);
/**
* 通过工号查询用户
*
@ -69,14 +44,6 @@ public interface UserMapper extends BaseMapper<User> {
*/
int getTotalCount(SearchKeyWords searchKeywords);
// /**
// * 通过用户ID删除用户
// *
// * @param userDeleteKeyWords
// * @return
// */
// int deleteUser(UserDeleteKeyWords userDeleteKeyWords);
/**
* 查找用户角色名称
*

View File

@ -17,12 +17,10 @@
<result column="user_status" jdbcType="VARCHAR" property="userStatus"/>
<result column="internship_end_date" jdbcType="DATE" property="internshipEndDate"/>
<result column="admin_type" jdbcType="VARCHAR" property="adminType"/>
<result column="creator" jdbcType="VARCHAR" property="creator"/>
<result column="creator_name" jdbcType="VARCHAR" property="creatorName"/>
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate"/>
<result column="modifier" jdbcType="VARCHAR" property="modifier"/>
<result column="modifier_name" jdbcType="VARCHAR" property="modifierName"/>
<result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified"/>
<result column="created_by" jdbcType="VARCHAR" property="createdBy"/>
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime"/>
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy"/>
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime"/>
<result column="effect_flag" jdbcType="TINYINT" property="effectFlag"/>
</resultMap>
@ -50,84 +48,6 @@
from ed_users
</sql>
<insert id="insert" parameterType="com.electromagnetic.industry.software.manage.pojo.models.User">
insert into ed_users(
<if test="id != null and id !='' ">id,</if>
<if test="userName != null and userName !='' ">user_name,</if>
<if test="workNumber != null and workNumber !='' ">work_number,</if>
<if test="mobile != null and mobile !='' ">mobile,</if>
<if test="userDept != null and userDept !='' ">user_dept,</if>
<if test="userTitle != null and userTitle !='' ">user_title,</if>
<if test="userAccount != null and userAccount !='' ">user_account,</if>
<if test="userPwd != null and userPwd !='' ">user_pwd,</if>
<if test="joinTime != null">join_time,</if>
<if test="isPublished != null">is_published,</if>
<if test="isActivated != null">is_activated,</if>
<if test="salt != null and salt !='' ">salt,</if>
<if test="userStatus != null and userStatus !='' ">user_status,</if>
<if test="internshipEndDate != null">internship_end_date,</if>
<if test="creator != null and creator !='' ">creator,</if>
<if test="creatorName != null and creatorName !='' ">creator_name,</if>
gmt_create,
effect_flag)
values (
<if test="id != null and id !='' ">#{id},</if>
<if test="userName != null and userName !='' ">#{userName},</if>
<if test="workNumber != null and workNumber !='' ">#{workNumber},</if>
<if test="mobile != null and mobile !='' ">#{mobile},</if>
<if test="userDept != null and userDept !='' ">#{userDept},</if>
<if test="userTitle != null and userTitle !='' ">#{userTitle},</if>
<if test="userAccount != null and userAccount !='' ">#{userAccount},</if>
<if test="userPwd != null and userPwd !='' ">#{userPwd},</if>
<if test="joinTime != null">#{joinTime},</if>
<if test="isPublished != null">#{isPublished},</if>
<if test="isActivated != null">#{isActivated},</if>
<if test="salt != null and salt !='' ">#{salt},</if>
<if test="userStatus != null and userStatus !='' ">#{userStatus},</if>
<if test="internshipEndDate != null">#{internshipEndDate},</if>
<if test="creator != null and creator !='' ">#{creator},</if>
<if test="creatorName != null and creatorName !='' ">#{creatorName},</if>
now(),
1
)
</insert>
<update id="modify" parameterType="com.electromagnetic.industry.software.manage.pojo.models.User">
update ed_users
<set>
<if test="id != null and id != ''">id = #{id},</if>
<if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="workNumber != null and workNumber != ''">work_number = #{workNumber},</if>
<if test="mobile != null and mobile != ''">mobile = #{mobile},</if>
<if test="userDept != null and userDept != ''">user_dept = #{userDept},</if>
<if test="userTitle != null and userTitle != ''">user_title = #{userTitle},</if>
<if test="userAccount != null and userAccount != ''">user_account = #{userAccount},</if>
<if test="joinTime != null">join_time = #{joinTime},</if>
<if test="userStatus != null and userStatus != ''">user_status = #{userStatus},</if>
<if test="isActivated != null and isActivated != ''">is_activated = #{isActivated},</if>
<if test="userPwd != null and userPwd != ''">user_pwd = #{userPwd},</if>
internship_end_date = #{internshipEndDate},
<if test="modifier != null and modifier != ''">modifier = #{modifier},</if>
<if test="modifierName != null and modifierName != ''">modifier_name = #{modifierName},</if>
gmt_modified=now()
</set>
where id= #{userId}
</update>
<update id="publish" parameterType="com.electromagnetic.industry.software.manage.pojo.other.PublishParam">
update ed_users
<trim prefix="SET" suffixOverrides=",">
is_published = 1,
<if test="modifier != null and modifier != ''">modifier = #{modifier},</if>
<if test="modifierName != null and modifierName != ''">modifier_name = #{modifierName},</if>
gmt_modified = now()
</trim>
where id IN
<foreach collection="userIds" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</update>
<select id="search" parameterType="com.electromagnetic.industry.software.manage.pojo.other.SearchKeyWords"
resultMap="UserResultMap">
SELECT *
@ -245,17 +165,6 @@
where id = #{userId}
</select>
<update id="deleteUser" parameterType="com.electromagnetic.industry.software.manage.pojo.other.UserDeleteKeyWords">
update ed_users
<set>
effect_flag=0,
modifier=#{modifier},
modifier_name=#{modifierName},
gmt_modified = now()
</set>
where id = #{userId}
</update>
<select id="selectUserRoles" parameterType="String" resultType="String">
select r.role_name
from ed_role r