181 lines
11 KiB
XML
181 lines
11 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.EmisSpecialCalcWeightMapper">
|
|
|
|
<resultMap type="EmisSpecialCalcWeight" id="EmisSpecialCalcWeightResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
|
|
<result property="id" column="id" />
|
|
<result property="prodCode" column="prod_code" />
|
|
<result property="prodName" column="prod_name" />
|
|
<result property="country" column="country" />
|
|
<result property="transLineCode" column="trans_line_code" />
|
|
<result property="status" column="status" />
|
|
<result property="carryType" column="carry_type" />
|
|
<result property="beginWeight" column="begin_weight" />
|
|
<result property="endWeight" column="end_weight" />
|
|
<result property="beginDate" column="begin_date" />
|
|
<result property="endDate" column="end_date" />
|
|
|
|
|
|
<association property="lineName" column="trans_line_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectLineNameByCode"/>
|
|
<association property="prodName" column="prod_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectProdNameByCode"/>
|
|
<association property="countryName" column="country" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectCountryNameByCode"/>
|
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectEmisSpecialCalcWeightVo">
|
|
select id, prod_code, prod_name, country, trans_line_code, status, carry_type, begin_weight, end_weight, begin_date, end_date, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_special_calc_weight
|
|
</sql>
|
|
|
|
<select id="selectEmisSpecialCalcWeightList" parameterType="EmisSpecialCalcWeight" resultMap="EmisSpecialCalcWeightResult">
|
|
<include refid="selectEmisSpecialCalcWeightVo"/>
|
|
<where>
|
|
del_flag='0'
|
|
<if test="id != null "> and id = #{id}</if>
|
|
<if test="prodCode != null and prodCode != ''"> and prod_code = #{prodCode}</if>
|
|
<if test="prodName != null and prodName != ''"> and prod_name like concat('%', #{prodName}, '%')</if>
|
|
<if test="country != null and country != ''"> and country = #{country}</if>
|
|
<if test="transLineCode != null and transLineCode != ''"> and trans_line_code = #{transLineCode}</if>
|
|
<if test="status != null "> and status = #{status}</if>
|
|
<if test="carryType != null and carryType != ''"> and carry_type = #{carryType}</if>
|
|
<if test="beginWeight != null "> and begin_weight = #{beginWeight}</if>
|
|
<if test="endWeight != null "> and end_weight = #{endWeight}</if>
|
|
<if test="beginDate != null "> and begin_date = #{beginDate}</if>
|
|
<if test="endDate != null "> and end_date = #{endDate}</if>
|
|
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
|
|
<if test="tenantId != null and tenantId != ''"> and tenant_id like concat('%', #{tenantId}, '%')</if>
|
|
<if test="delFlag != null and delFlag != ''"> and del_flag like concat('%', #{delFlag}, '%')</if>
|
|
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
|
|
<if test="createTime != null "> and create_time = #{createTime}</if>
|
|
<if test="updateBy != null and updateBy != ''"> and update_by = #{updateBy}</if>
|
|
<if test="updateTime != null "> and update_time = #{updateTime}</if>
|
|
<if test="createSite != null and createSite != ''"> and create_site = #{createSite}</if>
|
|
<if test="updateSite != null and updateSite != ''"> and update_site = #{updateSite}</if>
|
|
</where>
|
|
order by create_time desc
|
|
</select>
|
|
|
|
<select id="selectEmisSpecialCalcWeightById" parameterType="Long" resultMap="EmisSpecialCalcWeightResult">
|
|
select id, prod_code, prod_name, country, trans_line_code, status, carry_type, begin_weight, end_weight, begin_date, end_date, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
|
from emis_special_calc_weight a
|
|
where a.id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertEmisSpecialCalcWeight" parameterType="EmisSpecialCalcWeight" useGeneratedKeys="true" keyProperty="id">
|
|
insert into emis_special_calc_weight
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">id,</if>
|
|
<if test="prodCode != null and prodCode != ''">prod_code,</if>
|
|
<if test="prodName != null and prodName != ''">prod_name,</if>
|
|
<if test="country != null and country != ''">country,</if>
|
|
<if test="transLineCode != null and transLineCode != ''">trans_line_code,</if>
|
|
<if test="status != null">status,</if>
|
|
<if test="carryType != null and carryType != ''">carry_type,</if>
|
|
<if test="beginWeight != null">begin_weight,</if>
|
|
<if test="endWeight != null">end_weight,</if>
|
|
<if test="beginDate != null">begin_date,</if>
|
|
<if test="endDate != null">end_date,</if>
|
|
<if test="remark != null and remark != ''">remark,</if>
|
|
<if test="tenantId != null and tenantId != ''">tenant_id,</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>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">#{id},</if>
|
|
<if test="prodCode != null and prodCode != ''">#{prodCode},</if>
|
|
<if test="prodName != null and prodName != ''">#{prodName},</if>
|
|
<if test="country != null and country != ''">#{country},</if>
|
|
<if test="transLineCode != null and transLineCode != ''">#{transLineCode},</if>
|
|
<if test="status != null">#{status},</if>
|
|
<if test="carryType != null and carryType != ''">#{carryType},</if>
|
|
<if test="beginWeight != null">#{beginWeight},</if>
|
|
<if test="endWeight != null">#{endWeight},</if>
|
|
<if test="beginDate != null">#{beginDate},</if>
|
|
<if test="endDate != null">#{endDate},</if>
|
|
<if test="remark != null and remark != ''">#{remark},</if>
|
|
<if test="tenantId != null and tenantId != ''">#{tenantId},</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>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateEmisSpecialCalcWeight" parameterType="EmisSpecialCalcWeight">
|
|
update emis_special_calc_weight
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="prodCode != null and prodCode != ''">prod_code = #{prodCode},</if>
|
|
<if test="prodName != null and prodName != ''">prod_name = #{prodName},</if>
|
|
<if test="country != null and country != ''">country = #{country},</if>
|
|
<if test="transLineCode != null and transLineCode != ''">trans_line_code = #{transLineCode},</if>
|
|
<if test="status != null">status = #{status},</if>
|
|
<if test="carryType != null and carryType != ''">carry_type = #{carryType},</if>
|
|
<if test="beginWeight != null">begin_weight = #{beginWeight},</if>
|
|
<if test="endWeight != null">end_weight = #{endWeight},</if>
|
|
<if test="beginDate != null">begin_date = #{beginDate},</if>
|
|
<if test="endDate != null">end_date = #{endDate},</if>
|
|
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
|
<if test="tenantId != null and tenantId != ''">tenant_id = #{tenantId},</if>
|
|
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
|
|
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</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>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
|
|
<delete id="deleteEmisSpecialCalcWeightById" parameterType="Long">
|
|
update emis_special_calc_weight set del_flag='1' where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteEmisSpecialCalcWeightByIds" parameterType="String">
|
|
update emis_special_calc_weight set del_flag='1' where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<select id="checkUnique" parameterType="EmisSpecialCalcWeight" resultType="int">
|
|
select count(1) from emis_special_calc_weight
|
|
where del_flag='0'
|
|
<if test="id != null"> and id!=#{id} </if>
|
|
and prod_code = #{prodCode}
|
|
and
|
|
(
|
|
( begin_weight <![CDATA[< ]]> #{beginWeight} and #{beginWeight} <![CDATA[<= ]]> end_weight )
|
|
or ( begin_weight <![CDATA[< ]]> #{endWeight} and #{endWeight} <![CDATA[<= ]]> end_weight )
|
|
)
|
|
and
|
|
(
|
|
( begin_date <![CDATA[< ]]> #{beginDate} and #{beginDate} <![CDATA[<= ]]> end_date )
|
|
or ( begin_date <![CDATA[< ]]> #{endDate} and #{endDate} <![CDATA[<= ]]> end_date )
|
|
)
|
|
limit 1
|
|
</select>
|
|
|
|
|
|
<select id="getValidSpecialCalcWeight" resultMap="EmisSpecialCalcWeightResult">
|
|
select id, prod_code, prod_name, country, trans_line_code, status, carry_type, begin_weight, end_weight, begin_date, end_date, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
|
from emis_special_calc_weight a
|
|
where del_flag='0'
|
|
and prod_code = #{prodCode}
|
|
and ( begin_weight <![CDATA[< ]]> #{weight} and #{weight} <![CDATA[<= ]]> end_weight )
|
|
and ( begin_date <![CDATA[< ]]> #{sendDate} and #{sendDate} <![CDATA[<= ]]> end_date )
|
|
limit 1
|
|
</select>
|
|
|
|
</mapper> |