<?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.ycl.platform.mapper.TContractMapper">
|
|
<resultMap type="com.ycl.platform.domain.entity.TContract" id="TContractResult">
|
<result property="id" column="id" />
|
<result property="companyId" column="company_id" />
|
<result property="companyName" column="company_name" />
|
<result property="deptId" column="dept_id" />
|
<result property="deptName" column="dept_name" />
|
<result property="detail" column="detail" />
|
<result property="startTime" column="start_time" />
|
<result property="endTime" column="end_time" />
|
</resultMap>
|
|
<sql id="selectTContractVo">
|
select id, company_id, company_name, dept_id, dept_name, detail ,start_time,end_time from t_contract
|
</sql>
|
|
<select id="selectTContractList" parameterType="com.ycl.platform.domain.entity.TContract" resultMap="TContractResult">
|
<include refid="selectTContractVo"/>
|
<where>
|
<if test="companyId != null "> and company_id = #{companyId}</if>
|
<if test="companyName != null and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
|
<if test="deptId != null "> and dept_id = #{deptId}</if>
|
<if test="deptName != null and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
|
<if test="detail != null and detail != ''"> and detail = #{detail}</if>
|
<if test="startTime != null"> and start_time = #{startTime}</if>
|
<if test="endTime != null"> and end_time = #{endTime}</if>
|
</where>
|
</select>
|
|
<select id="selectTContractById" parameterType="Long" resultMap="TContractResult">
|
<include refid="selectTContractVo"/>
|
where id = #{id}
|
</select>
|
|
<insert id="insertTContract" parameterType="com.ycl.platform.domain.entity.TContract" useGeneratedKeys="true" keyProperty="id">
|
insert into t_contract
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="companyId != null">company_id,</if>
|
<if test="companyName != null">company_name,</if>
|
<if test="deptId != null">dept_id,</if>
|
<if test="deptName != null">dept_name,</if>
|
<if test="detail != null">detail,</if>
|
<if test="startTime != null">start_time,</if>
|
<if test="endTime != null">end_time,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="companyId != null">#{companyId},</if>
|
<if test="companyName != null">#{companyName},</if>
|
<if test="deptId != null">#{deptId},</if>
|
<if test="deptName != null">#{deptName},</if>
|
<if test="detail != null">#{detail},</if>
|
<if test="startTime != null">#{startTime},</if>
|
<if test="endTime != null">#{endTime},</if>
|
</trim>
|
</insert>
|
|
<update id="updateTContract" parameterType="com.ycl.platform.domain.entity.TContract">
|
update t_contract
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="companyId != null">company_id = #{companyId},</if>
|
<if test="companyName != null">company_name = #{companyName},</if>
|
<if test="deptId != null">dept_id = #{deptId},</if>
|
<if test="deptName != null">dept_name = #{deptName},</if>
|
<if test="detail != null">detail = #{detail},</if>
|
<if test="startTime != null">start_time = #{startTime},</if>
|
<if test="endTime != null">end_time = #{endTime},</if>
|
</trim>
|
where id = #{id}
|
</update>
|
|
<delete id="deleteTContractById" parameterType="Long">
|
delete from t_contract where id = #{id}
|
</delete>
|
|
<delete id="deleteTContractByIds" parameterType="String">
|
delete from t_contract where id in
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</delete>
|
</mapper>
|