使用mybatis-flex重构各模块代码:岗位管理
This commit is contained in:
parent
42a3285e8a
commit
82988f3385
@ -14,6 +14,7 @@ import com.ruoyi.system.domain.SysDept;
|
|||||||
import com.ruoyi.system.domain.SysPost;
|
import com.ruoyi.system.domain.SysPost;
|
||||||
import com.ruoyi.system.domain.SysRole;
|
import com.ruoyi.system.domain.SysRole;
|
||||||
import com.ruoyi.system.domain.SysUser;
|
import com.ruoyi.system.domain.SysUser;
|
||||||
|
import com.ruoyi.system.domain.bo.SysPostBo;
|
||||||
import com.ruoyi.system.service.*;
|
import com.ruoyi.system.service.*;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
@ -114,7 +115,7 @@ public class SysUserController extends BaseController {
|
|||||||
SysRole sysRole = new SysRole();
|
SysRole sysRole = new SysRole();
|
||||||
sysRole.setStatus(UserConstants.ROLE_NORMAL);
|
sysRole.setStatus(UserConstants.ROLE_NORMAL);
|
||||||
List<SysRole> roles = roleService.selectRoleList(sysRole);
|
List<SysRole> roles = roleService.selectRoleList(sysRole);
|
||||||
SysPost sysPost = new SysPost();
|
SysPostBo sysPost = new SysPostBo();
|
||||||
sysPost.setStatus(UserConstants.POST_NORMAL);
|
sysPost.setStatus(UserConstants.POST_NORMAL);
|
||||||
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||||
ajax.put("posts", postService.selectPostList(sysPost));
|
ajax.put("posts", postService.selectPostList(sysPost));
|
||||||
|
@ -22,29 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
from sys_post
|
from sys_post
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectPostList" parameterType="SysPost" resultMap="SysPostResult">
|
|
||||||
<include refid="selectPostVo"/>
|
|
||||||
<where>
|
|
||||||
<if test="postCode != null and postCode != ''">
|
|
||||||
AND post_code like concat('%', #{postCode}, '%')
|
|
||||||
</if>
|
|
||||||
<if test="status != null and status != ''">
|
|
||||||
AND status = #{status}
|
|
||||||
</if>
|
|
||||||
<if test="postName != null and postName != ''">
|
|
||||||
AND post_name like concat('%', #{postName}, '%')
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectPostAll" resultMap="SysPostResult">
|
|
||||||
<include refid="selectPostVo"/>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectPostById" parameterType="Long" resultMap="SysPostResult">
|
|
||||||
<include refid="selectPostVo"/>
|
|
||||||
where post_id = #{postId}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectPostListByUserId" parameterType="Long" resultType="Long">
|
<select id="selectPostListByUserId" parameterType="Long" resultType="Long">
|
||||||
select p.post_id
|
select p.post_id
|
||||||
@ -62,61 +40,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
where u.user_name = #{userName}
|
where u.user_name = #{userName}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="checkPostNameUnique" parameterType="String" resultMap="SysPostResult">
|
|
||||||
<include refid="selectPostVo"/>
|
|
||||||
where post_name=#{postName} limit 1
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="checkPostCodeUnique" parameterType="String" resultMap="SysPostResult">
|
|
||||||
<include refid="selectPostVo"/>
|
|
||||||
where post_code=#{postCode} limit 1
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<update id="updatePost" parameterType="SysPost">
|
|
||||||
update sys_post
|
|
||||||
<set>
|
|
||||||
<if test="postCode != null and postCode != ''">post_code = #{postCode},</if>
|
|
||||||
<if test="postName != null and postName != ''">post_name = #{postName},</if>
|
|
||||||
<if test="postSort != null">post_sort = #{postSort},</if>
|
|
||||||
<if test="status != null and status != ''">status = #{status},</if>
|
|
||||||
<if test="remark != null">remark = #{remark},</if>
|
|
||||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
|
||||||
update_time = sysdate()
|
|
||||||
</set>
|
|
||||||
where post_id = #{postId}
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<insert id="insertPost" parameterType="SysPost" useGeneratedKeys="true" keyProperty="postId">
|
|
||||||
insert into sys_post(
|
|
||||||
<if test="postId != null and postId != 0">post_id,</if>
|
|
||||||
<if test="postCode != null and postCode != ''">post_code,</if>
|
|
||||||
<if test="postName != null and postName != ''">post_name,</if>
|
|
||||||
<if test="postSort != null">post_sort,</if>
|
|
||||||
<if test="status != null and status != ''">status,</if>
|
|
||||||
<if test="remark != null and remark != ''">remark,</if>
|
|
||||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
|
||||||
create_time
|
|
||||||
)values(
|
|
||||||
<if test="postId != null and postId != 0">#{postId},</if>
|
|
||||||
<if test="postCode != null and postCode != ''">#{postCode},</if>
|
|
||||||
<if test="postName != null and postName != ''">#{postName},</if>
|
|
||||||
<if test="postSort != null">#{postSort},</if>
|
|
||||||
<if test="status != null and status != ''">#{status},</if>
|
|
||||||
<if test="remark != null and remark != ''">#{remark},</if>
|
|
||||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
||||||
sysdate()
|
|
||||||
)
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<delete id="deletePostById" parameterType="Long">
|
|
||||||
delete from sys_post where post_id = #{postId}
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
<delete id="deletePostByIds" parameterType="Long">
|
|
||||||
delete from sys_post where post_id in
|
|
||||||
<foreach collection="array" item="postId" open="(" separator="," close=")">
|
|
||||||
#{postId}
|
|
||||||
</foreach>
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue
Block a user