java-zk-app/bd-business/bd-business-bonus/src/main/resources/mapper/bonus/bonus/BdWaresBonusMapper.xml

53 lines
2.4 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.hzs.bonus.bonus.mapper.BdWaresBonusMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BdWaresBonusExt" type="com.hzs.common.domain.member.ext.BdWaresBonusExt">
<id column="PK_ID" property="pkId"/>
<result column="DEL_FLAG" property="delFlag"/>
<result column="PK_COUNTRY" property="pkCountry"/>
<result column="CREATION_TIME" property="creationTime"/>
<result column="MODIFIED_TIME" property="modifiedTime"/>
<result column="PK_CREATOR" property="pkCreator"/>
<result column="PK_MODIFIED" property="pkModified"/>
<result column="PK_WARES" property="pkWares"/>
<result column="ORDER_ASS_ACHIEVE" property="orderAssAchieve"/>
<result column="TOTAL_ALGEBRA" property="totalAlgebra"/>
<collection property="bdWaresBonusItemsList" ofType="com.hzs.common.domain.member.bonus.BdWaresBonusItems">
<result column="PK_ID_ITEM" property="pkId"/>
<result column="ASS_ACHIEVE" property="assAchieve"/>
<result column="ALGEBRA" property="algebra"/>
</collection>
</resultMap>
<select id="querySpecialWaresBonus" resultMap="BdWaresBonusExt">
select bw.*,ba.wares_code,ba.wares_name,bt.pk_id pk_id_item,bt.ass_achieve,bt.algebra from bd_wares_bonus bw
inner join bd_wares_bonus_items bt
on bw.pk_id=bt.pk_wares_bonus
inner join bd_wares ba
on ba.pk_id=bw.pk_wares
where bw.del_flag=0 and bt.del_flag=0 and ba.del_flag=0
<if test="waresCode != null and waresCode != ''">
and ba.wares_code=#{waresCode}
</if>
<if test="waresName != null and waresName != ''">
and ba.wares_name = #{waresName}
</if>
order by bw.pk_wares,bt.algebra
</select>
<select id="queryAllSpecialWaresBonus" resultMap="BdWaresBonusExt">
select bw.pk_id, bw.wares_code, bw.wares_name
from bd_wares bw
inner join bd_wares_extend be on bw.pk_id = be.pk_wares
left join bd_wares_bonus bwb on bw.pk_id = bwb.pk_wares and bwb.del_flag = 0
where bw.del_flag = 0
and be.del_flag = 0
and bw.special_area = 40
and be.is_put_on = 0
and bwb.pk_wares is null
</select>
</mapper>