123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- <?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.zhyc.xps.sys.mapper.PositionMapper">
- <resultMap id="PositionDtoResultMap" type="com.zhyc.xps.sys.dto.PositionDto">
- <result column="oc_id" property="ocId" jdbcType="BIGINT"/>
- <result column="position_id" property="positionId" jdbcType="BIGINT"/>
- <result column="position_name" property="positionName" jdbcType="VARCHAR"/>
- <result column="position_desc" property="positionDesc" jdbcType="VARCHAR"/>
- <result column="is_fixed" property="isFixed" jdbcType="BIGINT"/>
- </resultMap>
- <sql id="PositionDto_Cols">
- A.oc_id,
- A.position_id,
- A.position_name,
- A.position_desc,
- A.is_fixed
- </sql>
- <!--基于ID查询-->
- <select id="getById" resultMap="PositionDtoResultMap">
- SELECT
- <include refid="PositionDto_Cols"/>
- FROM s_position AS A
- WHERE A.oc_id = #{ocId} AND A.position_id = #{positionId}
- </select>
- <!--分页查询-->
- <select id="getByPage" parameterType="java.util.Map" resultMap="PositionDtoResultMap" >
- SELECT
- <include refid="PositionDto_Cols"/>
- FROM s_position AS A
- WHERE A.deleted_flag = 0
- <if test="ocId != null">
- AND A.oc_id = #{ocId, jdbcType=BIGINT}
- </if>
- <if test="positionId != null">
- AND A.position_id = #{positionId, jdbcType=BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- AND A.position_name LIKE "%"#{keywords}"%"
- </if>
- <if test="positionName != null and positionName != ''">
- AND A.position_name = #{positionName,jdbcType=VARCHAR}
- </if>
- order by A.position_id ASC
- </select>
- <!--列表查询-->
- <select id="getByList" parameterType="java.util.Map" resultMap="PositionDtoResultMap">
- SELECT
- <include refid="PositionDto_Cols"/>
- FROM s_position AS A
- WHERE A.deleted_flag = 0
- <if test="ocId != null">
- AND A.oc_id = #{ocId, jdbcType=BIGINT}
- </if>
- <if test="positionId != null">
- AND A.position_id = #{positionId, jdbcType=BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- AND A.position_name like "%"#{keywords}"%"
- </if>
- </select>
- <!--列表查询-->
- <select id="selectByList" parameterType="java.util.Map" resultMap="PositionDtoResultMap">
- SELECT
- <include refid="PositionDto_Cols"/>
- FROM s_position AS A
- WHERE A.deleted_flag = 0 AND A.is_fixed = 0 AND A.oc_id = #{ocId, jdbcType=BIGINT}
- <if test="positionId != null">
- AND A.position_id = #{positionId, jdbcType=BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- AND A.position_name like "%"#{keywords}"%"
- </if>
- </select>
- <!--新增-->
- <insert id="create" parameterType="com.zhyc.xps.sys.entity.Position">
- INSERT INTO s_position
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="ocId != null">
- oc_id,
- </if>
- <if test="positionId != null">
- position_id,
- </if>
- <if test="positionName != null and positionName !=''">
- position_name,
- </if>
- <if test="positionDesc != null and positionDesc !=''">
- position_desc,
- </if>
- <if test="isFixed != null">
- is_fixed,
- </if>
- <if test="createdBy != null">
- created_by,
- </if>
- <if test="createdAt != null">
- created_at,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="ocId != null">
- #{ocId,jdbcType=BIGINT},
- </if>
- <if test="positionId != null">
- #{positionId ,jdbcType=BIGINT},
- </if>
- <if test="positionName != null and positionName !=''">
- #{positionName ,jdbcType=VARCHAR},
- </if>
- <if test="positionDesc != null and positionDesc != ''">
- #{positionDesc ,jdbcType=VARCHAR},
- </if>
- <if test="isFixed != null">
- #{isFixed ,jdbcType=BIGINT},
- </if>
- <if test="createdBy != null">
- #{createdBy ,jdbcType=BIGINT},
- </if>
- <if test="createdAt != null">
- #{createdAt ,jdbcType=DATE},
- </if>
- </trim>
- </insert>
- <!--更新UPDATE-->
- <update id="update" parameterType="com.zhyc.xps.sys.entity.Position">
- UPDATE s_position
- <trim suffixOverrides=",">
- <set>
- <if test="positionName != null and positionName != ''">
- position_name = #{positionName ,jdbcType=VARCHAR},
- </if>
- <if test="positionDesc != null">
- position_desc = #{positionDesc ,jdbcType=VARCHAR},
- </if>
- <if test="updatedBy != null">
- updated_by = #{updatedBy ,jdbcType=BIGINT},
- </if>
- <if test="updatedAt != null">
- updated_at = #{updatedAt ,jdbcType=DATE}
- </if>
- </set>
- </trim>
- WHERE 1 = 1
- <if test="ocId != null">
- AND oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="positionId != null">
- AND position_id = #{positionId, jdbcType=BIGINT}
- </if>
- </update>
- <!--删除-->
- <update id="delete" parameterType="java.util.Map">
- UPDATE s_position
- <trim suffixOverrides=",">
- <set>
- <if test="deletedFlag != null">
- deleted_flag = #{deletedFlag ,jdbcType=BIGINT},
- </if>
- <if test="deletedBy != null">
- deleted_by = #{deletedBy ,jdbcType=BIGINT},
- </if>
- <if test="deletedAt != null">
- deleted_at = #{deletedAt ,jdbcType=DATE},
- </if>
- </set>
- </trim>
- WHERE oc_id = #{ocId, jdbcType=BIGINT}
- AND position_id = #{positionId, jdbcType=BIGINT}
- </update>
- </mapper>
|