From 3f2a477b1c3e4323e9de59fe96b75e69a1fb90d3 Mon Sep 17 00:00:00 2001 From: liding <756868258@qq.com> Date: 星期三, 07 五月 2025 14:45:44 +0800 Subject: [PATCH] mybatiesPlus --- src/main/resources/mapper/system/SysPostMapper.xml | 242 ++++++++++++++++++++++++------------------------ 1 files changed, 121 insertions(+), 121 deletions(-) diff --git a/src/main/resources/mybatis/system/SysPostMapper.xml b/src/main/resources/mapper/system/SysPostMapper.xml similarity index 91% rename from src/main/resources/mybatis/system/SysPostMapper.xml rename to src/main/resources/mapper/system/SysPostMapper.xml index be65f9a..177f74d 100644 --- a/src/main/resources/mybatis/system/SysPostMapper.xml +++ b/src/main/resources/mapper/system/SysPostMapper.xml @@ -1,122 +1,122 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper -PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" -"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.ruoyi.project.system.mapper.SysPostMapper"> - - <resultMap type="SysPost" id="SysPostResult"> - <id property="postId" column="post_id" /> - <result property="postCode" column="post_code" /> - <result property="postName" column="post_name" /> - <result property="postSort" column="post_sort" /> - <result property="status" column="status" /> - <result property="createBy" column="create_by" /> - <result property="createTime" column="create_time" /> - <result property="updateBy" column="update_by" /> - <result property="updateTime" column="update_time" /> - <result property="remark" column="remark" /> - </resultMap> - - <sql id="selectPostVo"> - select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark - from sys_post - </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 p.post_id - from sys_post p - left join sys_user_post up on up.post_id = p.post_id - left join sys_user u on u.user_id = up.user_id - where u.user_id = #{userId} - </select> - - <select id="selectPostsByUserName" parameterType="String" resultMap="SysPostResult"> - select p.post_id, p.post_name, p.post_code - from sys_post p - left join sys_user_post up on up.post_id = p.post_id - left join sys_user u on u.user_id = up.user_id - where u.user_name = #{userName} - </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> - +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper +PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" +"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.ruoyi.project.system.mapper.SysPostMapper"> + + <resultMap type="com.ruoyi.project.system.domain.SysPost" id="SysPostResult"> + <id property="postId" column="post_id" /> + <result property="postCode" column="post_code" /> + <result property="postName" column="post_name" /> + <result property="postSort" column="post_sort" /> + <result property="status" column="status" /> + <result property="createBy" column="create_by" /> + <result property="createTime" column="create_time" /> + <result property="updateBy" column="update_by" /> + <result property="updateTime" column="update_time" /> + <result property="remark" column="remark" /> + </resultMap> + + <sql id="selectPostVo"> + select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark + from sys_post + </sql> + + <select id="selectPostList" parameterType="com.ruoyi.project.system.domain.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 p.post_id + from sys_post p + left join sys_user_post up on up.post_id = p.post_id + left join sys_user u on u.user_id = up.user_id + where u.user_id = #{userId} + </select> + + <select id="selectPostsByUserName" parameterType="String" resultMap="SysPostResult"> + select p.post_id, p.post_name, p.post_code + from sys_post p + left join sys_user_post up on up.post_id = p.post_id + left join sys_user u on u.user_id = up.user_id + where u.user_name = #{userName} + </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="com.ruoyi.project.system.domain.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="com.ruoyi.project.system.domain.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> \ No newline at end of file -- Gitblit v1.9.3