ghy-all/ghy-custom/src/main/resources/mapper/customer/CustomerSelectionMapper.xml

97 lines
4.8 KiB
XML

<?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.ghy.customer.mapper.CustomerSelectionMapper">
<resultMap type="CustomerSelection" id="CustomerSelectionResult">
<result property="id" column="id" />
<result property="workId" column="work_id" />
<result property="deptId" column="dept_id" />
<result property="customerId" column="customer_id" />
<result property="deptCategoryId" column="dept_category_id" />
<result property="selectionType" column="selection_type" />
<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="selectCustomerSelectionVo">
select id, work_id, dept_id, customer_id, dept_category_id, selection_type, create_by, create_time, update_by, update_time, remark from customer_selection
</sql>
<select id="selectCustomerSelectionList" parameterType="CustomerSelection" resultMap="CustomerSelectionResult">
<include refid="selectCustomerSelectionVo"/>
<where>
<if test="workId != null "> and work_id = #{workId}</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="customerId != null "> and customer_id = #{customerId}</if>
<if test="deptCategoryId != null "> and dept_category_id = #{deptCategoryId}</if>
<if test="selectionType != null "> and selection_type = #{selectionType}</if>
</where>
</select>
<select id="selectCustomerSelectionById" parameterType="String" resultMap="CustomerSelectionResult">
<include refid="selectCustomerSelectionVo"/>
where id = #{id}
</select>
<insert id="insertCustomerSelection" parameterType="CustomerSelection" useGeneratedKeys="true" keyProperty="id">
insert into customer_selection
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="workId != null">work_id,</if>
<if test="deptId != null">dept_id,</if>
<if test="customerId != null">customer_id,</if>
<if test="deptCategoryId != null">dept_category_id,</if>
<if test="selectionType != null">selection_type,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="workId != null">#{workId},</if>
<if test="deptId != null">#{deptId},</if>
<if test="customerId != null">#{customerId},</if>
<if test="deptCategoryId != null">#{deptCategoryId},</if>
<if test="selectionType != null">#{selectionType},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateCustomerSelection" parameterType="CustomerSelection">
update customer_selection
<trim prefix="SET" suffixOverrides=",">
<if test="workId != null">work_id = #{workId},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="customerId != null">customer_id = #{customerId},</if>
<if test="deptCategoryId != null">dept_category_id = #{deptCategoryId},</if>
<if test="selectionType != null">selection_type = #{selectionType},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCustomerSelectionById" parameterType="String">
delete from customer_selection where id = #{id}
</delete>
<delete id="deleteCustomerSelectionByIds" parameterType="String">
delete from customer_selection where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>