优化mybatis方法去掉冗余方法

This commit is contained in:
wh
2026-04-23 17:00:02 +08:00
parent 9483bea005
commit 2beebbe469
7 changed files with 23 additions and 73 deletions

View File

@@ -22,21 +22,6 @@
status, session_version, created_at, updated_at
</sql>
<insert id="insert" parameterType="com.labelsys.backend.entity.SysUser">
insert into sys_user (
id, company_id, phone, username, role, position, real_name, password_hash, must_change_password,
status, session_version, created_at, updated_at
)
values (
#{id}, #{companyId}, #{phone}, #{username}, #{role}, #{position}, #{realName}, #{passwordHash}, #{mustChangePassword},
#{status}, #{sessionVersion}, current_timestamp, current_timestamp
)
</insert>
<select id="findById" resultMap="SysUserResultMap">
select <include refid="UserColumns"/> from sys_user where id = #{id}
</select>
<select id="findByIdAndCompanyId" resultMap="SysUserResultMap">
select <include refid="UserColumns"/> from sys_user where id = #{id} and company_id = #{companyId}
</select>
@@ -45,10 +30,6 @@
select <include refid="UserColumns"/> from sys_user where company_id = #{companyId} and phone = #{phone}
</select>
<select id="listByCompanyId" resultMap="SysUserResultMap">
select <include refid="UserColumns"/> from sys_user where company_id = #{companyId} order by id
</select>
<select id="listCompanyAdmins" resultMap="SysUserResultMap">
select <include refid="UserColumns"/>
from sys_user
@@ -91,4 +72,4 @@
<delete id="deleteAll">
delete from sys_user
</delete>
</mapper>
</mapper>