You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sdny-order/order-management-base-service/src/main/resources/mybatis/mapper/CommodityMapper.xml

1338 lines
50 KiB

<?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.dxhy.order.baseservice.module.commodity.dao.CommodityMapper">
<resultMap id="commodityCodeResultMap" type="com.dxhy.order.baseservice.module.commodity.model.CommodityCodeEntity">
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="commodity_id" jdbcType="VARCHAR" property="commodityId"/>
<result column="sort_id" jdbcType="BIGINT" property="sortId"/>
<result column="xhf_nsrsbh" jdbcType="VARCHAR" property="xhfNsrsbh"/>
<result column="merchandise_name" jdbcType="VARCHAR" property="xmmc"/>
<result column="encoding" jdbcType="VARCHAR" property="zxbm"/>
<result column="tax_items" jdbcType="VARCHAR" property="spsm"/>
<result column="brief_code" jdbcType="VARCHAR" property="spjm"/>
<result column="tax_rate" jdbcType="VARCHAR" property="sl"/>
<result column="specification_model" jdbcType="VARCHAR" property="ggxh"/>
<result column="metering_unit" jdbcType="VARCHAR" property="xmdw"/>
<result column="unit_price" jdbcType="VARCHAR" property="xmdj"/>
<result column="tax_logo" jdbcType="VARCHAR" property="hsbz"/>
<result column="hide_the_logo" jdbcType="VARCHAR" property="ycbz"/>
<result column="enjoy_preferential_policies" jdbcType="VARCHAR" property="yhzcbs"/>
<result column="tax_class_code" jdbcType="VARCHAR" property="spbm"/>
<result column="tax_classification_name" jdbcType="VARCHAR" property="ssflMc"/>
<result column="preferential_policies_type" jdbcType="VARCHAR" property="lslbs"/>
<result column="zzstsgl" jdbcType="VARCHAR" property="zzstsgl"/>
<result column="user_id" jdbcType="VARCHAR" property="userId"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime"/>
<result column="modify_user_id" jdbcType="CHAR" property="modifyUserId"/>
<result column="group_id" jdbcType="VARCHAR" property="groupId"/>
<result column="group_name" jdbcType="VARCHAR" property="groupName"/>
<result column="enterprise_name" jdbcType="VARCHAR" property="xhfMc"/>
<result column="data_source" jdbcType="VARCHAR" property="dataSource"/>
<result column="matching_state" jdbcType="VARCHAR" property="matchingState"/>
<result column="data_state" jdbcType="VARCHAR" property="dataState"/>
<result column="tax_class_abbreviation" jdbcType="VARCHAR" property="spjc"/>
<result column="description" jdbcType="VARCHAR" property="bz"/>
<result column="collect_ident" jdbcType="VARCHAR" property="collectIdent"/>
<result column="cpy" jdbcType="VARCHAR" property="cpy"/>
<result column="bmb_bbh" jdbcType="VARCHAR" property="bmbBbh"/>
<result column="jdc" jdbcType="VARCHAR" property="jdc"/>
<result column="wlflbm" jdbcType="VARCHAR" property="wlflbm"/>
<result column="wlflmc" jdbcType="VARCHAR" property="wlflmc"/>
<result column="ent_id" jdbcType="VARCHAR" property="entId"/>
<result column="tswl" jdbcType="VARCHAR" property="tswl"/>
<result column="invoice_name" jdbcType="VARCHAR" property="invoiceName"/>
</resultMap>
<sql id="Base_Column_List">
id
, commodity_id, sort_id, xhf_nsrsbh, merchandise_name,encoding, tax_items, brief_code,
tax_rate, specification_model, metering_unit, unit_price, tax_logo, hide_the_logo,
enjoy_preferential_policies, tax_class_code, tax_classification_name, preferential_policies_type,zzstsgl,
user_id, create_time, modify_time, modify_user_id, group_id,enterprise_name,data_source,
matching_state,data_state,tax_class_abbreviation,description,collect_ident,cpy,bmb_bbh,jdc,wlflbm,wlflmc,ent_id,tswl,invoice_name
</sql>
<!-- 查询 -->
<select id="selectCommodityList" parameterType="map" resultMap="commodityCodeResultMap">
<bind name="dataType" value="${dataType}"/>
SELECT
cc.id,
cc.commodity_id,
cc.sort_id,
cc.xhf_nsrsbh,
cc.merchandise_name,
cc.tax_items,
cc.brief_code,
cc.tax_rate,
cc.specification_model,
cc.metering_unit,
cc.unit_price,
cc.tax_logo,
cc.hide_the_logo,
cc.enjoy_preferential_policies,
cc.tax_class_code,
cc.tax_classification_name,
cc.preferential_policies_type,
cc.zzstsgl,
cc.user_id,
cc.create_time,
cc.modify_time,
cc.modify_user_id,
cc.encoding,
cc.group_id,
cc.enterprise_name,
cc.data_source,
cc.matching_state,
cc.data_state,
cc.tax_class_abbreviation,
cc.description,
cc.cpy,
cc.jdc,
cc.bmb_bbh,
gc.group_name,
cc.wlflbm,
cc.wlflmc,
cc.ent_id,
cc.tswl,
cc.invoice_name
FROM
commodity_code cc LEFT JOIN group_commodity gc
ON gc.id = cc.group_id
<where>
<if test="shList != null and shList.size() == 0">
and cc.xhf_nsrsbh = ''
</if>
<if test="shList != null and shList.size() == 1">
and cc.xhf_nsrsbh =
<foreach collection="shList" index="index" item="item">
#{item}
</foreach>
</if>
<if test="shList != null and shList.size() > 1">
and cc.xhf_nsrsbh in
<foreach collection="shList" index="index" item="item"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="entId != null and entId.size() == 0">
and cc.ent_id = ''
</if>
<if test="entId != null and entId.size() == 1">
and cc.ent_id =
<foreach collection="entId" index="index" item="item">
#{item}
</foreach>
</if>
<if test="entId != null and entId.size() > 1">
and cc.ent_id in
<foreach collection="entId" index="index" item="item"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
<!-- 商品编码表ID-->
<if test="map.id != null and map.id != ''">
AND cc.id = #{map.id,jdbcType=VARCHAR}
</if>
<!--商品id-->
<if test="map.commodityId != null and map.commodityId != ''">
AND cc.commodity_id = #{map.commodityId,jdbcType=VARCHAR}
</if>
<if test="map.groupId != null and map.groupId != ''">
AND cc.group_id = #{map.groupId,jdbcType=VARCHAR}
</if>
<if test="map.ppzt != null and map.ppzt != ''">
AND cc.matching_state = #{map.ppzt,jdbcType=VARCHAR}
</if>
<if test="map.sjly != null and map.sjly != ''">
AND cc.data_source = #{map.sjly,jdbcType=VARCHAR}
</if>
<if test="map.sjzt != null and map.sjzt != ''">
AND cc.data_state = #{map.sjzt,jdbcType=VARCHAR}
</if>
<!--<if test="map.entId != null and map.entId != ''">-->
<!-- AND cc.ent_id = #{map.entId,jdbcType=VARCHAR}-->
<!--</if>-->
<if test="map.tswl != null and map.tswl != ''">
AND cc.tswl = #{map.tswl,jdbcType=VARCHAR}
</if>
<if test="dataType == 0">
<choose>
<!--模糊查询的标识(0表示不进行模糊查询,1表示模糊查询)-->
<when test="map.fuzzyQuery != null and map.fuzzyQuery !='' and map.fuzzyQuery =='0'.toString() ">
<if test="map.spmc != null and map.spmc != ''">
AND cc.merchandise_name = #{map.spmc,jdbcType=VARCHAR}
</if>
<if test="map.qymc != null and map.qymc != ''">
AND cc.enterprise_name = #{map.qymc,jdbcType=VARCHAR}
</if>
</when>
<otherwise>
<if test="map.spmc != null and map.spmc != ''">
AND cc.merchandise_name LIKE CONCAT(CONCAT('%',#{map.spmc}),'%')
</if>
<if test="map.qymc != null and map.qymc != ''">
AND cc.enterprise_name LIKE CONCAT(CONCAT('%',#{map.qymc},'%'))
</if>
</otherwise>
</choose>
<if test="map.nsrsbh != null and map.nsrsbh != ''">
AND cc.xhf_nsrsbh LIKE CONCAT(CONCAT('%',#{map.nsrsbh},'%'))
</if>
<if test="map.spbm != null and map.spbm != ''">
AND cc.encoding LIKE CONCAT(CONCAT('%',#{map.spbm},'%'))
</if>
<if test="map.ssmc != null and map.ssmc != ''">
AND cc.tax_classification_name LIKE CONCAT(CONCAT('%',#{map.ssmc},'%'))
</if>
<if test="map.ssjc != null and map.ssjc != ''">
AND cc.tax_class_abbreviation LIKE CONCAT(CONCAT('%',#{map.ssjc},'%'))
</if>
<if test="map.ssbm != null and map.ssbm != ''">
AND cc.tax_class_code LIKE CONCAT(CONCAT('%',#{map.ssbm},'%'))
</if>
</if>
<if test="dataType == 1">
<choose>
<!--模糊查询的标识(0表示不进行模糊查询,1表示模糊查询)-->
<when test="map.fuzzyQuery != null and map.fuzzyQuery !='' and map.fuzzyQuery =='0'.toString() ">
<if test="map.spmc != null and map.spmc != ''">
AND cc.merchandise_name = #{map.spmc,jdbcType=VARCHAR}
</if>
<if test="map.qymc != null and map.qymc != ''">
AND cc.enterprise_name = #{map.qymc,jdbcType=VARCHAR}
</if>
</when>
<otherwise>
<if test="map.spmc != null and map.spmc != ''">
AND cc.merchandise_name LIKE '%' || #{map.spmc} || '%'
</if>
<if test="map.qymc != null and map.qymc != ''">
AND cc.enterprise_name LIKE '%' || #{map.qymc} || '%'
</if>
</otherwise>
</choose>
<if test="map.nsrsbh != null and map.nsrsbh != ''">
AND cc.xhf_nsrsbh LIKE '%' || #{map.nsrsbh} || '%'
</if>
<if test="map.spbm != null and map.spbm != ''">
AND cc.encoding LIKE '%' || #{map.spbm} || '%'
</if>
<if test="map.ssmc != null and map.ssmc != ''">
AND cc.tax_classification_name LIKE '%' || #{map.ssmc} || '%'
</if>
<if test="map.ssjc != null and map.ssjc != ''">
AND cc.tax_class_abbreviation LIKE '%' || #{map.ssjc}|| '%'
</if>
<if test="map.ssbm != null and map.ssbm != ''">
AND cc.tax_class_code LIKE '%' || #{map.ssbm} || '%'
</if>
</if>
</where>
ORDER BY cc.create_time DESC
</select>
<!-- 修改 -->
<update id="updateCommodity" parameterType="com.dxhy.order.baseservice.module.commodity.model.CommodityCodeEntity">
<bind name="dataType" value="${dataType}"/>
update commodity_code
<set>
<if test="commodityCode.commodityId != null">
commodity_id = #{commodityCode.commodityId,jdbcType=VARCHAR},
</if>
<if test="commodityCode.sortId != null">
sort_id = #{commodityCode.sortId,jdbcType=BIGINT},
</if>
<if test="commodityCode.xhfNsrsbh != null">
xhf_nsrsbh = #{commodityCode.xhfNsrsbh,jdbcType=VARCHAR},
</if>
<if test="commodityCode.xmmc != null">
merchandise_name = #{commodityCode.xmmc,jdbcType=VARCHAR},
</if>
<if test="commodityCode.zxbm != null">
encoding = #{commodityCode.zxbm,jdbcType=VARCHAR},
</if>
<if test="commodityCode.spsm != null">
tax_items = #{commodityCode.spsm,jdbcType=VARCHAR},
</if>
<if test="commodityCode.spjm != null">
brief_code = #{commodityCode.spjm,jdbcType=VARCHAR},
</if>
<if test="commodityCode.sl != null">
tax_rate = #{commodityCode.sl,jdbcType=VARCHAR},
</if>
<if test="commodityCode.ggxh != null">
specification_model = #{commodityCode.ggxh,jdbcType=VARCHAR},
</if>
<if test="commodityCode.xmdw != null">
metering_unit = #{commodityCode.xmdw,jdbcType=VARCHAR},
</if>
<if test="commodityCode.xmdj != null">
unit_price = #{commodityCode.xmdj,jdbcType=VARCHAR},
</if>
<if test="commodityCode.hsbz != null">
tax_logo = #{commodityCode.hsbz,jdbcType=VARCHAR},
</if>
<if test="commodityCode.ycbz != null">
hide_the_logo = #{commodityCode.ycbz,jdbcType=VARCHAR},
</if>
<if test="commodityCode.yhzcbs != null">
enjoy_preferential_policies = #{commodityCode.yhzcbs,jdbcType=VARCHAR},
</if>
<if test="commodityCode.spbm != null">
tax_class_code = #{commodityCode.spbm,jdbcType=VARCHAR},
</if>
<if test="commodityCode.ssflMc != null">
tax_classification_name = #{commodityCode.ssflMc,jdbcType=VARCHAR},
</if>
<if test="commodityCode.lslbs != null">
preferential_policies_type = #{commodityCode.lslbs,jdbcType=VARCHAR},
</if>
<if test="commodityCode.zzstsgl != null">
zzstsgl = #{commodityCode.zzstsgl,jdbcType=VARCHAR},
</if>
<if test="commodityCode.userId != null">
user_id = #{commodityCode.userId,jdbcType=VARCHAR},
</if>
<if test="commodityCode.createTime != null">
create_time = #{commodityCode.createTime,jdbcType=TIMESTAMP},
</if>
<if test="dataType == 0">
modify_time = now(),
</if>
<if test="dataType == 1">
modify_time = SYSDATE,
</if>
<if test="commodityCode.modifyUserId != null">
modify_user_id = #{commodityCode.modifyUserId,jdbcType=CHAR},
</if>
<if test="commodityCode.groupId != null">
group_id = #{commodityCode.groupId,jdbcType=VARCHAR},
</if>
<if test="commodityCode.bz != null">
description = #{commodityCode.bz,jdbcType=VARCHAR},
</if>
<if test="commodityCode.xhfMc != null">
enterprise_name = #{commodityCode.xhfMc,jdbcType=VARCHAR},
</if>
<if test="commodityCode.dataSource != null">
data_source = #{commodityCode.dataSource,jdbcType=VARCHAR},
</if>
<if test="commodityCode.matchingState != null">
matching_state = #{commodityCode.matchingState,jdbcType=VARCHAR},
</if>
<if test="commodityCode.dataState != null">
data_state = #{commodityCode.dataState,jdbcType=VARCHAR},
</if>
<if test="commodityCode.spjc != null">
tax_class_abbreviation = #{commodityCode.spjc,jdbcType=VARCHAR},
</if>
<if test="commodityCode.collectIdent != null">
collect_ident = #{commodityCode.collectIdent,jdbcType=VARCHAR},
</if>
<if test="commodityCode.cpy != null">
cpy = #{commodityCode.cpy,jdbcType=VARCHAR},
</if>
<if test="commodityCode.bmbBbh != null">
bmb_bbh = #{commodityCode.bmbBbh,jdbcType=VARCHAR},
</if>
<if test="commodityCode.jdc != null">
jdc = #{commodityCode.jdc,jdbcType=VARCHAR},
</if>
<if test="commodityCode.wlflbm != null">
wlflbm = #{commodityCode.wlflbm,jdbcType=VARCHAR},
</if>
<if test="commodityCode.wlflmc != null">
wlflmc = #{commodityCode.wlflmc,jdbcType=VARCHAR},
</if>
<if test="commodityCode.entId != null">
ent_id = #{commodityCode.entId,jdbcType=VARCHAR},
</if>
<if test="commodityCode.tswl != null">
tswl = #{commodityCode.tswl,jdbcType=VARCHAR},
</if>
<if test="commodityCode.invoiceName != null">
invoice_name = #{commodityCode.invoiceName,jdbcType=VARCHAR},
</if>
</set>
<where>
<if test="commodityCode.id != null and commodityCode.id != ''">
AND id = #{commodityCode.id,jdbcType=VARCHAR}
</if>
<if test="shList != null and shList.size() == 0">
and xhf_nsrsbh = ''
</if>
<if test="shList != null and shList.size() == 1">
and xhf_nsrsbh =
<foreach collection="shList" index="index" item="item">
#{item}
</foreach>
</if>
<if test="shList != null and shList.size() > 1">
and xhf_nsrsbh in
<foreach collection="shList" index="index" item="item"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
</update>
<update id="batchUpdateCommodity" parameterType="com.dxhy.order.baseservice.module.commodity.model.CommodityCodeEntity">
<bind name="dataType" value="${dataType}"/>
update commodity_code
<set>
<if test="commodityCode.zxbm != null">
encoding = #{commodityCode.zxbm,jdbcType=VARCHAR},
</if>
<if test="commodityCode.xmdw != null">
metering_unit = #{commodityCode.xmdw,jdbcType=VARCHAR},
</if>
<if test="commodityCode.createTime != null">
create_time = #{commodityCode.createTime,jdbcType=TIMESTAMP},
</if>
<if test="commodityCode.bz != null">
description = #{commodityCode.bz,jdbcType=VARCHAR},
</if>
<if test="commodityCode.wlflbm != null">
wlflbm = #{commodityCode.wlflbm,jdbcType=VARCHAR},
</if>
<if test="commodityCode.wlflmc != null">
wlflmc = #{commodityCode.wlflmc,jdbcType=VARCHAR},
</if>
<if test="commodityCode.ggxh != null">
specification_model = #{commodityCode.ggxh,jdbcType=VARCHAR},
</if>
<if test="commodityCode.commodityId != null">
commodity_id = #{commodityCode.commodityId,jdbcType=VARCHAR},
</if>
<if test="commodityCode.sortId != null">
sort_id = #{commodityCode.sortId,jdbcType=BIGINT},
</if>
<if test="commodityCode.xmmc != null">
merchandise_name = #{commodityCode.xmmc,jdbcType=VARCHAR},
</if>
<if test="commodityCode.zzstsgl != null">
zzstsgl = #{commodityCode.zzstsgl,jdbcType=VARCHAR},
</if>
<if test="commodityCode.spjc != null">
tax_class_abbreviation = #{commodityCode.spjc,jdbcType=VARCHAR},
</if>
<if test="commodityCode.spbm != null">
tax_class_code = #{commodityCode.spbm,jdbcType=VARCHAR},
</if>
<if test="commodityCode.ssflMc != null">
tax_classification_name = #{commodityCode.ssflMc,jdbcType=VARCHAR},
</if>
<if test="commodityCode.yhzcbs != null">
enjoy_preferential_policies = #{commodityCode.yhzcbs,jdbcType=VARCHAR},
</if>
<if test="commodityCode.hsbz != null">
tax_logo = #{commodityCode.hsbz,jdbcType=VARCHAR},
</if>
<if test="commodityCode.spjm != null">
brief_code = #{commodityCode.spjm,jdbcType=VARCHAR},
</if>
<if test="commodityCode.sl != null">
tax_rate = #{commodityCode.sl,jdbcType=VARCHAR},
</if>
</set>
<where>
id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id,jdbcType=VARCHAR}
</foreach>
</where>
</update>
<insert id="insertCommodity" parameterType="com.dxhy.order.baseservice.module.commodity.model.CommodityCodeEntity">
<bind name="dataType" value="${dataType}"/>
insert into commodity_code
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="commodityId != null">
commodity_id,
</if>
<if test="sortId != null">
sort_id,
</if>
<if test="xhfNsrsbh != null">
xhf_nsrsbh,
</if>
<if test="xmmc != null">
merchandise_name,
</if>
<if test="zxbm != null">
encoding,
</if>
<if test="spsm != null">
tax_items,
</if>
<if test="spjm != null">
brief_code,
</if>
<if test="sl != null">
tax_rate,
</if>
<if test="ggxh != null">
specification_model,
</if>
<if test="xmdw != null">
metering_unit,
</if>
<if test="xmdj != null">
unit_price,
</if>
<if test="hsbz != null">
tax_logo,
</if>
<if test="ycbz != null">
hide_the_logo,
</if>
<if test="yhzcbs != null">
enjoy_preferential_policies,
</if>
<if test="spbm != null">
tax_class_code,
</if>
<if test="ssflMc != null">
tax_classification_name,
</if>
<if test="lslbs != null">
preferential_policies_type,
</if>
<if test="zzstsgl != null">
zzstsgl,
</if>
<if test="userId != null">
user_id,
</if>
create_time,
modify_time,
<if test="modifyUserId != null">
modify_user_id,
</if>
<if test="groupId != null">
group_id,
</if>
<if test="bz != null">
description,
</if>
<if test="xhfMc != null">
enterprise_name,
</if>
<if test="dataSource != null">
data_source,
</if>
<if test="matchingState != null">
matching_state,
</if>
<if test="dataState != null">
data_state,
</if>
<if test="spjc != null">
tax_class_abbreviation,
</if>
<if test="collectIdent != null">
collect_ident,
</if>
<if test="cpy != null">
cpy,
</if>
<if test="bmbBbh != null">
bmb_bbh,
</if>
<if test="jdc != null">
jdc,
</if>
<if test="wlflbm != null">
wlflbm,
</if>
<if test="wlflmc != null">
wlflmc,
</if>
<if test="entId != null">
ent_id,
</if>
<if test="tswl != null">
tswl,
</if>
<if test="invoiceName != null">
invoice_name,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="commodityId != null">
#{commodityId,jdbcType=VARCHAR},
</if>
<if test="sortId != null">
#{sortId,jdbcType=BIGINT},
</if>
<if test="xhfNsrsbh != null">
#{xhfNsrsbh,jdbcType=VARCHAR},
</if>
<if test="xmmc != null">
#{xmmc,jdbcType=VARCHAR},
</if>
<if test="zxbm != null">
#{zxbm,jdbcType=VARCHAR},
</if>
<if test="spsm != null">
#{spsm,jdbcType=VARCHAR},
</if>
<if test="spjm != null">
#{spjm,jdbcType=VARCHAR},
</if>
<if test="sl != null">
#{sl,jdbcType=VARCHAR},
</if>
<if test="ggxh != null">
#{ggxh,jdbcType=VARCHAR},
</if>
<if test="xmdw != null">
#{xmdw,jdbcType=VARCHAR},
</if>
<if test="xmdj != null">
#{xmdj,jdbcType=VARCHAR},
</if>
<if test="hsbz != null">
#{hsbz,jdbcType=VARCHAR},
</if>
<if test="ycbz != null">
#{ycbz,jdbcType=VARCHAR},
</if>
<if test="yhzcbs != null">
#{yhzcbs,jdbcType=VARCHAR},
</if>
<if test="spbm != null">
#{spbm,jdbcType=VARCHAR},
</if>
<if test="ssflMc != null">
#{ssflMc,jdbcType=VARCHAR},
</if>
<if test="lslbs != null">
#{lslbs,jdbcType=VARCHAR},
</if>
<if test="zzstsgl != null">
#{zzstsgl,jdbcType=VARCHAR},
</if>
<if test="userId != null">
#{userId,jdbcType=VARCHAR},
</if>
<if test="dataType == 0">
now(),
now(),
</if>
<if test="dataType == 1">
SYSDATE,
SYSDATE,
</if>
<if test="modifyUserId != null">
#{modifyUserId,jdbcType=CHAR},
</if>
<if test="groupId != null">
#{groupId,jdbcType=VARCHAR},
</if>
<if test="bz != null">
#{bz,jdbcType=VARCHAR},
</if>
<if test="xhfMc != null">
#{xhfMc,jdbcType=VARCHAR},
</if>
<if test="dataSource != null">
#{dataSource,jdbcType=VARCHAR},
</if>
<if test="matchingState != null">
#{matchingState,jdbcType=VARCHAR},
</if>
<if test="dataState != null">
#{dataState,jdbcType=VARCHAR},
</if>
<if test="spjc != null">
#{spjc,jdbcType=VARCHAR},
</if>
<if test="collectIdent != null">
#{collectIdent,jdbcType=VARCHAR},
</if>
<if test="cpy != null">
#{cpy,jdbcType=VARCHAR},
</if>
<if test="bmbBbh != null">
#{bmbBbh,jdbcType=VARCHAR},
</if>
<if test="jdc != null">
#{jdc,jdbcType=VARCHAR},
</if>
<if test="wlflbm != null">
#{wlflbm,jdbcType=VARCHAR},
</if>
<if test="wlflmc != null">
#{wlflmc,jdbcType=VARCHAR},
</if>
<if test="entId != null">
#{entId,jdbcType=VARCHAR},
</if>
<if test="tswl != null">
#{tswl,jdbcType=VARCHAR},
</if>
<if test="invoiceName != null">
#{invoiceName,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<insert id="insertCommodityOnDuplicateKey"
parameterType="com.dxhy.order.baseservice.module.commodity.model.CommodityCodeEntity">
<bind name="dataType" value="${dataType}"/>
insert into commodity_code
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="commodityId != null">
commodity_id,
</if>
<if test="sortId != null">
sort_id,
</if>
<if test="xhfNsrsbh != null">
xhf_nsrsbh,
</if>
<if test="xmmc != null">
merchandise_name,
</if>
<if test="zxbm != null">
encoding,
</if>
<if test="spsm != null">
tax_items,
</if>
<if test="spjm != null">
brief_code,
</if>
<if test="sl != null">
tax_rate,
</if>
<if test="ggxh != null">
specification_model,
</if>
<if test="xmdw != null">
metering_unit,
</if>
<if test="xmdj != null">
unit_price,
</if>
<if test="hsbz != null">
tax_logo,
</if>
<if test="ycbz != null">
hide_the_logo,
</if>
<if test="yhzcbs != null">
enjoy_preferential_policies,
</if>
<if test="spbm != null">
tax_class_code,
</if>
<if test="ssflMc != null">
tax_classification_name,
</if>
<if test="lslbs != null">
preferential_policies_type,
</if>
<if test="zzstsgl != null">
zzstsgl,
</if>
<if test="userId != null">
user_id,
</if>
create_time,
modify_time,
<if test="modifyUserId != null">
modify_user_id,
</if>
<if test="groupId != null">
group_id,
</if>
<if test="bz != null">
description,
</if>
<if test="xhfMc != null">
enterprise_name,
</if>
<if test="dataSource != null">
data_source,
</if>
<if test="matchingState != null">
matching_state,
</if>
<if test="dataState != null">
data_state,
</if>
<if test="spjc != null">
tax_class_abbreviation,
</if>
<if test="collectIdent != null">
collect_ident,
</if>
<if test="cpy != null">
cpy,
</if>
<if test="bmbBbh != null">
bmb_bbh,
</if>
<if test="jdc != null">
jdc,
</if>
<if test="wlflbm != null">
wlflbm,
</if>
<if test="wlflmc != null">
wlflmc,
</if>
<if test="entId != null">
ent_id,
</if>
<if test="tswl != null">
tswl,
</if>
<if test="invoiceName != null">
invoice_name,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="commodityId != null">
#{commodityId,jdbcType=VARCHAR},
</if>
<if test="sortId != null">
#{sortId,jdbcType=BIGINT},
</if>
<if test="xhfNsrsbh != null">
#{xhfNsrsbh,jdbcType=VARCHAR},
</if>
<if test="xmmc != null">
#{xmmc,jdbcType=VARCHAR},
</if>
<if test="zxbm != null">
#{zxbm,jdbcType=VARCHAR},
</if>
<if test="spsm != null">
#{spsm,jdbcType=VARCHAR},
</if>
<if test="spjm != null">
#{spjm,jdbcType=VARCHAR},
</if>
<if test="sl != null">
#{sl,jdbcType=VARCHAR},
</if>
<if test="ggxh != null">
#{ggxh,jdbcType=VARCHAR},
</if>
<if test="xmdw != null">
#{xmdw,jdbcType=VARCHAR},
</if>
<if test="xmdj != null">
#{xmdj,jdbcType=VARCHAR},
</if>
<if test="hsbz != null">
#{hsbz,jdbcType=VARCHAR},
</if>
<if test="ycbz != null">
#{ycbz,jdbcType=VARCHAR},
</if>
<if test="yhzcbs != null">
#{yhzcbs,jdbcType=VARCHAR},
</if>
<if test="spbm != null">
#{spbm,jdbcType=VARCHAR},
</if>
<if test="ssflMc != null">
#{ssflMc,jdbcType=VARCHAR},
</if>
<if test="lslbs != null">
#{lslbs,jdbcType=VARCHAR},
</if>
<if test="zzstsgl != null">
#{zzstsgl,jdbcType=VARCHAR},
</if>
<if test="userId != null">
#{userId,jdbcType=VARCHAR},
</if>
<if test="dataType == 0">
now(),
now(),
</if>
<if test="dataType == 1">
SYSDATE,
SYSDATE,
</if>
<if test="modifyUserId != null">
#{modifyUserId,jdbcType=CHAR},
</if>
<if test="groupId != null">
#{groupId,jdbcType=VARCHAR},
</if>
<if test="bz != null">
#{bz,jdbcType=VARCHAR},
</if>
<if test="xhfMc != null">
#{xhfMc,jdbcType=VARCHAR},
</if>
<if test="dataSource != null">
#{dataSource,jdbcType=VARCHAR},
</if>
<if test="matchingState != null">
#{matchingState,jdbcType=VARCHAR},
</if>
<if test="dataState != null">
#{dataState,jdbcType=VARCHAR},
</if>
<if test="spjc != null">
#{spjc,jdbcType=VARCHAR},
</if>
<if test="collectIdent != null">
#{collectIdent,jdbcType=VARCHAR},
</if>
<if test="cpy != null">
#{cpy,jdbcType=VARCHAR},
</if>
<if test="bmbBbh != null">
#{bmbBbh,jdbcType=VARCHAR},
</if>
<if test="jdc != null">
#{jdc,jdbcType=VARCHAR},
</if>
<if test="wlflbm != null">
#{wlflbm,jdbcType=VARCHAR},
</if>
<if test="wlflmc != null">
#{wlflmc,jdbcType=VARCHAR},
</if>
<if test="entId != null">
#{entId,jdbcType=VARCHAR},
</if>
<if test="tswl != null">
#{tswl,jdbcType=VARCHAR},
</if>
<if test="invoiceName != null">
#{invoiceName,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByGropId" parameterType="String">
UPDATE commodity_code
SET
group_id = ''
WHERE group_id = #{id,jdbcType=VARCHAR}
<if test="shList != null and shList.size() == 0">
and xhf_nsrsbh = ''
</if>
<if test="shList != null and shList.size() == 1">
and xhf_nsrsbh =
<foreach collection="shList" index="index" item="item">
#{item}
</foreach>
</if>
<if test="shList != null and shList.size() > 1">
and xhf_nsrsbh in
<foreach collection="shList" index="index" item="item"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
</update>
<delete id="deleteCommodity" parameterType="String">
DELETE
FROM
commodity_code
WHERE id = #{id,jdbcType=VARCHAR}
<if test="shList != null and shList.size() == 0">
and xhf_nsrsbh = ''
</if>
<if test="shList != null and shList.size() == 1">
and xhf_nsrsbh =
<foreach collection="shList" index="index" item="item">
#{item}
</foreach>
</if>
<if test="shList != null and shList.size() > 1">
and xhf_nsrsbh in
<foreach collection="shList" index="index" item="item"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
</delete>
<select id="queryCommodityInfoList" resultMap="commodityCodeResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
commodity_code cc
<where>
<if test="pageSpxxReq.dataStatus!=null and pageSpxxReq.dataStatus!=''">
AND cc.data_state = #{pageSpxxReq.dataStatus,jdbcType=VARCHAR}
</if>
<if test="pageSpxxReq.id!=null and pageSpxxReq.id!=''">
AND cc.id = #{pageSpxxReq.id,jdbcType=VARCHAR}
</if>
<if test="pageSpxxReq.spId!=null and pageSpxxReq.spId!=''">
AND cc.commodity_id = #{pageSpxxReq.spId,jdbcType=VARCHAR}
</if>
<if test="pageSpxxReq.spdw!=null and pageSpxxReq.spdw!=''">
AND cc.metering_unit = #{pageSpxxReq.spdw,jdbcType=VARCHAR}
</if>
<if test="pageSpxxReq.spdj!=null and pageSpxxReq.spdj!=''">
AND cc.unit_price = #{pageSpxxReq.spdj,jdbcType=VARCHAR}
</if>
<if test="pageSpxxReq.sl!=null and pageSpxxReq.sl!=''">
AND cc.tax_rate = #{pageSpxxReq.sl,jdbcType=VARCHAR}
</if>
<if test="pageSpxxReq.spmc!=null and pageSpxxReq.spmc!=''">
AND cc.merchandise_name LIKE CONCAT(CONCAT('%',#{pageSpxxReq.spmc}),'%')
</if>
<if test="pageSpxxReq.zxbm!=null and pageSpxxReq.zxbm!=''">
AND cc.encoding LIKE CONCAT(CONCAT('%',#{pageSpxxReq.zxbm}),'%')
</if>
<if test="pageSpxxReq.ggxh!=null and pageSpxxReq.ggxh!=''">
AND cc.specification_model LIKE CONCAT(CONCAT('%',#{pageSpxxReq.ggxh}),'%')
</if>
<if test="pageSpxxReq.deptId!=null and pageSpxxReq.deptId!=''">
AND cc.ent_id = #{pageSpxxReq.deptId}
</if>
<!-- 成品油类型 1 成品油 -->
<if test='pageSpxxReq.cpylx=="1"'>
AND cc.cpy = 'Y'
</if>
<!-- 成品油类型 0 非成品油 -->
<if test='pageSpxxReq.cpylx=="0"'>
AND cc.cpy = 'N'
</if>
<!-- 机动车类型 1 机动车 -->
<if test='pageSpxxReq.jdclx=="1"'>
AND cc.jdc = 'Y'
</if>
<!-- 机动车类型 0 非机动车 -->
<if test='pageSpxxReq.jdclx=="0"'>
AND cc.jdc = 'N'
</if>
<if test="shList != null and shList.size() == 0">
and cc.xhf_nsrsbh = ''
</if>
<if test="shList != null and shList.size() == 1">
and cc.xhf_nsrsbh =
<foreach collection="shList" index="index" item="item">
#{item}
</foreach>
</if>
<if test="shList != null and shList.size() > 1">
and cc.xhf_nsrsbh in
<foreach collection="shList" index="index" item="item"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
and cc.xhf_nsrsbh != '-1'
</where>
limit 1000
</select>
<!--查询集团下面企业可采集的数据 匹配状态为0(已匹配) 数据状态为0(启用) 数据来源为1(页面创建)、2(模板导入)-->
<select id="getCommodityCode" resultMap="commodityCodeResultMap" parameterType="string">
SELECT
t.*
FROM
commodity_code t
WHERE t.collect_ident is null
AND t.matching_state = '0'
AND t.data_state = '0'
and t.xhf_nsrsbh != '-1'
AND (
t.data_source = '1'
OR t.data_source = '2'
)
<if test="shList != null and shList.size() == 0">
and t.xhf_nsrsbh = ''
</if>
<if test="shList != null and shList.size() == 1">
and t.xhf_nsrsbh =
<foreach collection="shList" index="index" item="item">
#{item}
</foreach>
</if>
<if test="shList != null and shList.size() > 1">
and t.xhf_nsrsbh in
<foreach collection="shList" index="index" item="item"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<!-- 根据id查询 -->
<select id="queryCommodityById" parameterType="string" resultMap="commodityCodeResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
commodity_code
<where>
<if test="id != null and id !=''">
and id = #{id,jdbcType=VARCHAR}
</if>
<if test="commodityId != null and commodityId !=''">
and commodity_id = #{commodityId,jdbcType=VARCHAR}
</if>
<if test="shList != null and shList.size() == 0">
and xhf_nsrsbh = ''
</if>
<if test="shList != null and shList.size() == 1">
and xhf_nsrsbh =
<foreach collection="shList" index="index" item="item">
#{item}
</foreach>
</if>
<if test="shList != null and shList.size() > 1">
and xhf_nsrsbh in
<foreach collection="shList" index="index" item="item"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
and xhf_nsrsbh != '-1'
</where>
</select>
<select id="queryProductList" parameterType="map" resultMap="commodityCodeResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
commodity_code cc
WHERE cc.data_state = '0'
AND cc.matching_state = '0'
<if test="map.productName != null and map.productName != ''">
AND cc.merchandise_name = #{map.productName,jdbcType=VARCHAR}
</if>
<if test="map.taxClassCode != null and map.taxClassCode != ''">
AND cc.tax_class_code = #{map.taxClassCode,jdbcType=VARCHAR}
</if>
<if test="map.zxbm != null and map.zxbm != '' ">
AND cc.encoding = #{map.zxbm,jdbcType=VARCHAR}
</if>
<if test="map.ggxh != null ">
AND cc.specification_model = #{map.ggxh,jdbcType=VARCHAR}
</if>
<if test="map.xmdw != null ">
AND cc.metering_unit = #{map.xmdw,jdbcType=VARCHAR}
</if>
<if test="map.xmdj != null ">
AND cc.unit_price = #{map.xmdj,jdbcType=VARCHAR}
</if>
<if test="map.sl != null ">
AND cc.tax_rate = #{map.sl,jdbcType=VARCHAR}
</if>
<if test="shList != null and shList.size() == 0">
and cc.xhf_nsrsbh = ''
</if>
<if test="shList != null and shList.size() == 1">
and cc.xhf_nsrsbh =
<foreach collection="shList" index="index" item="item">
#{item}
</foreach>
</if>
<if test="shList != null and shList.size() > 1">
and cc.xhf_nsrsbh in
<foreach collection="shList" index="index" item="item"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="map.entId != null ">
AND cc.ent_id = #{map.entId,jdbcType=VARCHAR}
</if>
<if test="map.tswl != null ">
AND cc.tswl = #{map.tswl,jdbcType=VARCHAR}
</if>
and cc.xhf_nsrsbh != '-1'
</select>
<select id="queryByCommodityXmmc" parameterType="map" resultMap="commodityCodeResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
commodity_code cc
WHERE cc.merchandise_name like concat("%",#{xmmc},"%")
and cc.xhf_nsrsbh = #{xhfNsrsbh} limit 1
</select>
<select id="queryByCommoditySpbmCompany" parameterType="map" resultMap="commodityCodeResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
commodity_code cc
WHERE cc.encoding =#{spbm}
</select>
<select id="queryCountByEntAndEncode" resultType="java.lang.Integer">
SELECT
count(*)
FROM
commodity_code cc
<where>
<if test="encoding != null and encoding != ''">
cc.encoding =#{encoding}
</if>
<if test="merchandiseName != null and merchandiseName != ''">
and cc.merchandise_name =#{merchandiseName}
</if>
<if test="entId != null and entId != ''">
and cc.ent_id =#{entId}
</if>
</where>
</select>
<!-- 通用条件查询 -->
<select id="queryCommodityInfoListByMap" resultMap="commodityCodeResultMap">
<bind name="dataType" value="${dataType}"/>
<if test="dataType == 0">
SELECT
<include refid="Base_Column_List"/>
FROM
commodity_code cc
<where>
<if test="shList != null and shList.size() == 0">
and cc.xhf_nsrsbh = ''
</if>
<if test="shList != null and shList.size() == 1">
and cc.xhf_nsrsbh =
<foreach collection="shList" index="index" item="item">
#{item}
</foreach>
</if>
<if test="shList != null and shList.size() > 1">
and cc.xhf_nsrsbh in
<foreach collection="shList" index="index" item="item"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="map.merchandiseName!=null and map.merchandiseName!=''">
AND cc.merchandise_name LIKE CONCAT(CONCAT('%',#{map.merchandiseName}),'%')
</if>
<if test="map.encoding!=null and map.encoding!=''">
AND cc.encoding LIKE CONCAT(CONCAT('%',#{map.encoding}),'%')
</if>
<!-- 成品油类型 1 成品油 -->
<if test='map.cpylx == "1"'>
AND cc.cpy = 'Y'
</if>
<!-- 成品油类型 0 非成品油 -->
<if test='map.cpylx == "0"'>
AND cc.cpy = 'N'
</if>
<!-- 机动车类型 1 机动车 -->
<if test='map.jdclx == "1"'>
AND cc.jdc = 'Y'
</if>
<!-- 机动车类型 0 非机动车 -->
<if test='map.jdclx == "0"'>
AND cc.jdc = 'N'
</if>
and cc.xhf_nsrsbh != '-1'
</where>
<choose>
<when test="map.orderBy !=null and map.orderBy == '0' ">
order by cc.create_time asc
</when>
<otherwise>
order by cc.create_time desc
</otherwise>
</choose>
</if>
<if test="dataType == 1">
SELECT
<include refid="Base_Column_List"/>
FROM
commodity_code cc
<where>
<if test="shList != null and shList.size() == 0">
and cc.xhf_nsrsbh = ''
</if>
<if test="shList != null and shList.size() == 1">
and cc.xhf_nsrsbh =
<foreach collection="shList" index="index" item="item">
#{item}
</foreach>
</if>
<if test="shList != null and shList.size() > 1">
and cc.xhf_nsrsbh in
<foreach collection="shList" index="index" item="item"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="map.merchandiseName!=null and map.merchandiseName!=''">
AND cc.merchandise_name LIKE '%' || #{map.merchandiseName} || '%'
</if>
<if test="map.encoding!=null and map.encoding!=''">
AND cc.encoding LIKE '%' || #{map.encoding} || '%'
</if>
<!-- 成品油类型 1 成品油 -->
<if test='map.cpylx=="1"'>
AND cc.cpy = 'Y'
</if>
<!-- 成品油类型 0 非成品油 -->
<if test='map.cpylx=="0"'>
AND cc.cpy = 'N'
</if>
<!-- 机动车类型 1 机动车 -->
<if test='map.jdclx=="1"'>
AND cc.jdc = 'Y'
</if>
<!-- 机动车类型 0 非机动车 -->
<if test='map.jdclx=="0"'>
AND cc.jdc = 'N'
</if>
and cc.xhf_nsrsbh != '-1'
</where>
<choose>
<when test="map.orderBy !=null and map.orderBy == '0' ">
order by cc.create_time asc
</when>
<otherwise>
order by cc.create_time desc
</otherwise>
</choose>
</if>
</select>
</mapper>