emis-service/emis-biz/src/main/resources/mapper/EmisWaybillOtherMapper.xml

125 lines
5.9 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.xdadan.erp.emis.mapper.EmisWaybillOtherMapper">
<resultMap type="EmisWaybillOther" id="EmisWaybillOtherResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
<result property="id" column="id" />
<result property="waybillId" column="waybill_id" />
<result property="billCode" column="bill_code" />
<result property="salesSupport" column="sales_support" />
<result property="moneyUserId" column="money_user_id" />
<result property="moneyCompany" column="money_company" />
<result property="cabinetNumber" column="cabinet_number" />
</resultMap>
<sql id="selectEmisWaybillOtherVo">
select
a.id,
a.waybill_id,
a.bill_code,
a.sales_support,
a.money_user_id,
mu.company as money_company,
a.cabinet_number,
a.del_flag,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.create_site,
a.update_site,
a.remark
from emis_waybill_other a
left join emis_money_user mu on a.money_user_id = mu.id and mu.del_flag = '0'
</sql>
<select id="selectEmisWaybillOtherById" parameterType="Long" resultMap="EmisWaybillOtherResult">
<include refid="selectEmisWaybillOtherVo"/>
where a.id = #{id} and a.del_flag = '0'
</select>
<select id="selectEmisWaybillOtherByWaybillId" parameterType="Long" resultMap="EmisWaybillOtherResult">
<include refid="selectEmisWaybillOtherVo"/>
where a.waybill_id = #{waybillId} and a.del_flag = '0'
limit 1
</select>
<select id="selectEmisWaybillOtherByBillCode" parameterType="String" resultMap="EmisWaybillOtherResult">
<include refid="selectEmisWaybillOtherVo"/>
where a.bill_code = #{billCode} and a.del_flag = '0'
limit 1
</select>
<insert id="insertEmisWaybillOther" parameterType="EmisWaybillOther" useGeneratedKeys="true" keyProperty="id">
insert into emis_waybill_other
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="waybillId != null">waybill_id,</if>
<if test="billCode != null and billCode != ''">bill_code,</if>
<if test="salesSupport != null and salesSupport != ''">sales_support,</if>
<if test="moneyUserId != null">money_user_id,</if>
<if test="cabinetNumber != null">cabinet_number,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="createSite != null and createSite != ''">create_site,</if>
<if test="updateSite != null and updateSite != ''">update_site,</if>
<if test="remark != null and remark != ''">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="waybillId != null">#{waybillId},</if>
<if test="billCode != null and billCode != ''">#{billCode},</if>
<if test="salesSupport != null and salesSupport != ''">#{salesSupport},</if>
<if test="moneyUserId != null">#{moneyUserId},</if>
<if test="cabinetNumber != null">#{cabinetNumber},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createSite != null and createSite != ''">#{createSite},</if>
<if test="updateSite != null and updateSite != ''">#{updateSite},</if>
<if test="remark != null and remark != ''">#{remark},</if>
</trim>
</insert>
<update id="updateEmisWaybillOther" parameterType="EmisWaybillOther">
update emis_waybill_other
<trim prefix="SET" suffixOverrides=",">
<if test="waybillId != null">waybill_id = #{waybillId},</if>
<if test="billCode != null and billCode != ''">bill_code = #{billCode},</if>
<if test="salesSupport != null">sales_support = #{salesSupport},</if>
<if test="moneyUserId != null">money_user_id = #{moneyUserId},</if>
<if test="cabinetNumber != null">cabinet_number = #{cabinetNumber},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createSite != null and createSite != ''">create_site = #{createSite},</if>
<if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEmisWaybillOtherById" parameterType="Long">
update emis_waybill_other set del_flag = '1' where id = #{id}
</delete>
<delete id="deleteEmisWaybillOtherByWaybillId" parameterType="Long">
update emis_waybill_other set del_flag = '1' where waybill_id = #{waybillId}
</delete>
<delete id="deleteEmisWaybillOtherByBillCode" parameterType="String">
update emis_waybill_other set del_flag = '1' where bill_code = #{billCode}
</delete>
</mapper>