123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207 |
- <?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.liang.dao.SysPostInfoDao">
- <resultMap type="com.liang.entity.SysPostInfo" id="SysPostInfoMap">
- <result property="postId" column="post_id" jdbcType="INTEGER"/>
- <result property="postCode" column="post_code" jdbcType="VARCHAR"/>
- <result property="postName" column="post_name" jdbcType="VARCHAR"/>
- <result property="postSort" column="post_sort" jdbcType="INTEGER"/>
- <result property="status" column="status" jdbcType="VARCHAR"/>
- <result property="createUser" column="create_user" jdbcType="INTEGER"/>
- <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
- <result property="updateUser" column="update_user" jdbcType="INTEGER"/>
- <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
- <result property="descript" column="descript" jdbcType="VARCHAR"/>
- </resultMap>
- <!--查询单个-->
- <select id="queryById" resultMap="SysPostInfoMap">
- select
- post_id, post_code, post_name, post_sort, status, create_user, create_time, update_user, update_time, descript
- from sys_post_info
- where post_id = #{postId}
- </select>
- <!--查询指定行数据-->
- <select id="queryAllByLimit" resultMap="SysPostInfoMap">
- select
- post_id, post_code, post_name, post_sort, status, create_user, create_time, update_user, update_time, descript
- from sys_post_info
- <where>
- <if test="postId != null">
- and post_id = #{postId}
- </if>
- <if test="postCode != null and postCode != ''">
- and post_code = #{postCode}
- </if>
- <if test="postName != null and postName != ''">
- and post_name = #{postName}
- </if>
- <if test="postSort != null">
- and post_sort = #{postSort}
- </if>
- <if test="status != null and status != ''">
- and status = #{status}
- </if>
- <if test="createUser != null">
- and create_user = #{createUser}
- </if>
- <if test="createTime != null">
- and create_time = #{createTime}
- </if>
- <if test="updateUser != null">
- and update_user = #{updateUser}
- </if>
- <if test="updateTime != null">
- and update_time = #{updateTime}
- </if>
- <if test="descript != null and descript != ''">
- and descript = #{descript}
- </if>
- </where>
- limit #{pageable.offset}, #{pageable.pageSize}
- </select>
- <!--统计总行数-->
- <select id="count" resultType="java.lang.Long">
- select count(1)
- from sys_post_info
- <where>
- <if test="postId != null">
- and post_id = #{postId}
- </if>
- <if test="postCode != null and postCode != ''">
- and post_code = #{postCode}
- </if>
- <if test="postName != null and postName != ''">
- and post_name = #{postName}
- </if>
- <if test="postSort != null">
- and post_sort = #{postSort}
- </if>
- <if test="status != null and status != ''">
- and status = #{status}
- </if>
- <if test="createUser != null">
- and create_user = #{createUser}
- </if>
- <if test="createTime != null">
- and create_time = #{createTime}
- </if>
- <if test="updateUser != null">
- and update_user = #{updateUser}
- </if>
- <if test="updateTime != null">
- and update_time = #{updateTime}
- </if>
- <if test="descript != null and descript != ''">
- and descript = #{descript}
- </if>
- </where>
- </select>
- <!--新增所有列-->
- <insert id="insert" keyProperty="postId" useGeneratedKeys="true">
- if not exists (select * from sys_post_info where post_code = #{postCode} and post_name = #{postName})
- insert into sys_post_info(
- <if test="descript != null and descript != ''">
- descript,
- </if>
- post_code, post_name, post_sort, status, create_user, create_time)
- values (
- <if test="descript != null and descript != ''">
- #{descript},
- </if>
- #{postCode}, #{postName}, #{postSort}, #{status}, #{createUser}, GETDATE())
- </insert>
- <!--通过主键修改数据-->
- <update id="update">
- update sys_post_info
- set post_code = #{postCode},
- post_name = #{postName},
- post_sort = #{postSort},
- status = #{status},
- descript = #{descript},
- update_time = GETDATE()
- where post_id = #{postId}
- </update>
- <!--通过主键删除-->
- <delete id="deleteById">
- delete from sys_post_info where post_id = #{postId}
- </delete>
- <!--查询所有岗位-->
- <select id="getSysPostInfoList" resultMap="SysPostInfoMap" parameterType="map">
- select p.*, u.name as CJRXM
- from sys_post_info p
- left join sys_user_info u on u.user_id = p.create_user
- <where>
- <if test="postCode != null and postCode != ''">
- and post_code like '%'+#{postCode}+'%'
- </if>
- <if test="postName != null and postName != ''">
- and post_name like '%'+#{postName}+'%'
- </if>
- <if test="status != null and status != ''">
- and status = #{status}
- </if>
- </where>
- <choose>
- <when test="sortName != null and sortName != '' and sortOrder != null and sortOrder != ''">
- order by ${sortName} ${sortOrder}
- </when>
- <otherwise>
- order by post_sort asc
- </otherwise>
- </choose>
- </select>
- <!--查询岗位-->
- <select id="getSysPostInfo" resultMap="SysPostInfoMap" parameterType="map">
- select * from sys_post_info
- where status = 0
- <if test="postCode != null and postCode != ''">
- and post_code = #{postCode}
- </if>
- <if test="postName != null and postName != ''">
- and post_name = #{postName}
- </if>
- <if test="status != null and status != ''">
- and status = #{status}
- </if>
- </select>
- <!--查询岗位-->
- <select id="getSysPostInfo1" resultMap="SysPostInfoMap" parameterType="map">
- select * from sys_post_info
- where status = 0
- <if test="postId != null and postId != ''">
- and post_id = #{postId}
- </if>
- <if test="postCode != null and postCode != ''">
- and post_code = #{postCode}
- </if>
- <if test="postName != null and postName != ''">
- and post_name = #{postName}
- </if>
- <if test="status != null and status != ''">
- and status = #{status}
- </if>
- </select>
- <!--批量删除登陆日志-->
- <delete id="batchDelete" parameterType="java.util.ArrayList">
- delete from sys_post_info
- where post_id in
- <foreach item="item" index="index" collection="postIdList" open = "(" separator = "," close = ")">
- #{item}
- </foreach>
- </delete>
- </mapper>
|