<?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.gk.firework.Mapper.ProductInfoMapper" >
|
<resultMap id="BaseResultMap" type="com.gk.firework.Domain.ProductInfo" >
|
<!-- -->
|
<id column="id" property="id" jdbcType="BIGINT" />
|
<result column="name" property="name" jdbcType="VARCHAR" />
|
<result column="directioncode" property="directionCode" jdbcType="VARCHAR" />
|
<result column="purchaseprice" property="purchasePrice" jdbcType="DECIMAL" />
|
<result column="saleprice" property="salePrice" jdbcType="DECIMAL" />
|
<result column="manufacturer" property="manufacturer" jdbcType="VARCHAR" />
|
<result column="specification" property="specification" jdbcType="VARCHAR" />
|
<result column="explosivecontent" property="explosiveContent" jdbcType="DECIMAL" />
|
<result column="type" property="type" jdbcType="VARCHAR" />
|
<result column="secondarytype" property="secondaryType" jdbcType="VARCHAR" />
|
<result column="level" property="level" jdbcType="VARCHAR" />
|
<result column="productdate" property="productDate" jdbcType="TIMESTAMP" />
|
<result column="boxnumber" property="boxNumber" jdbcType="INTEGER" />
|
<result column="packing" property="packing" jdbcType="VARCHAR" />
|
<result column="companynumber" property="companyNumber" jdbcType="VARCHAR" />
|
<result column="isdel" property="isDel" jdbcType="TINYINT" />
|
<result column="isold" property="isOld" jdbcType="TINYINT" />
|
</resultMap>
|
<resultMap id="ProductVoResultMap" type="com.gk.firework.Domain.Vo.ProductVo"/>
|
<sql id="Base_Column_List" >
|
<!-- -->
|
id, name, directioncode, purchaseprice, saleprice, manufacturer, specification, explosivecontent,
|
type, secondarytype, level, productdate, boxnumber, packing,companynumber, isold
|
</sql>
|
<update id="deleteByEnterpriseName" parameterType="java.lang.String">
|
update product
|
set
|
isdel = 1,
|
modifiedby = #{name},
|
modifieddate = now()
|
where manufacturer = #{enterpriseName}
|
</update>
|
|
<select id="selectProductInfos" resultMap="BaseResultMap">
|
select
|
<include refid="Base_Column_List"/>
|
from
|
product
|
<where>
|
1=1
|
and isdel = 0
|
<if test="name != null and name != ''">
|
and `name` like concat('%',#{name},'%')
|
</if>
|
|
<if test="directionCode != null and directionCode != ''">
|
and directioncode like concat('%',#{directionCode},'%')
|
</if>
|
|
<if test="manufacturer != null and manufacturer != ''">
|
and manufacturer like concat('%',#{manufacturer},'%')
|
</if>
|
<if test="type != null and type != ''">
|
and `type` = #{condition.type}
|
</if>
|
<if test="secondaryType != null and secondaryType != ''">
|
and `secondarytype` = #{condition.secondaryType}
|
</if>
|
</where>
|
</select>
|
|
<select id="selectProductDataGrid" resultMap="BaseResultMap">
|
select
|
product.id,
|
product.NAME,
|
product.directioncode,
|
product.purchaseprice,
|
<if test="condition.companynumber != null and condition.companynumber !=''">
|
IFNULL(productprice.price,0) as saleprice,
|
</if>
|
product.manufacturer,
|
product.specification,
|
product.explosivecontent,
|
product.type,
|
product.secondarytype,
|
product.LEVEL,
|
product.productdate,
|
product.boxnumber,
|
product.packing,
|
product.companynumber
|
from
|
product
|
<if test="condition.companynumber != null and condition.companynumber !=''">
|
LEFT JOIN productprice ON productprice.companynumber = #{condition.companynumber}
|
AND productprice.itemcode = product.directioncode
|
</if>
|
<where>
|
1=1
|
and isdel = 0
|
<if test="condition.name != null and condition.name != ''">
|
and `name` like concat('%',#{condition.name},'%')
|
</if>
|
|
<if test="condition.directionCode != null and condition.directionCode != ''">
|
and directioncode like concat('%',#{condition.directionCode},'%')
|
</if>
|
|
<if test="condition.manufacturer != null and condition.manufacturer != ''">
|
and manufacturer like concat('%',#{condition.manufacturer},'%')
|
</if>
|
|
<if test="condition.type != null and condition.type != ''">
|
and `type` = #{condition.type}
|
</if>
|
<if test="condition.secondaryType != null and condition.secondaryType != ''">
|
and secondarytype = #{condition.secondaryType}
|
</if>
|
<if test="condition.isOld != null and condition.isOld != ''">
|
and isold = #{condition.isOld}
|
</if>
|
</where>
|
</select>
|
|
<select id="selectProductsByDirectionCode" resultMap="BaseResultMap">
|
select
|
product.id,
|
product.NAME,
|
product.directioncode,
|
product.purchaseprice,
|
<if test="companyNumber != null and companyNumber !=''">
|
IFNULL(productprice.price,0) as saleprice,
|
</if>
|
product.manufacturer,
|
product.specification,
|
product.explosivecontent,
|
product.type,
|
product.secondarytype,
|
product.LEVEL,
|
product.productdate,
|
product.boxnumber,
|
product.packing,
|
product.companynumber
|
from product
|
<if test="companyNumber != null and companyNumber !=''">
|
LEFT JOIN productprice ON productprice.companynumber = #{companyNumber}
|
AND productprice.itemcode = product.directioncode
|
</if>
|
<where>
|
directioncode = '${directionCode}'
|
and isdel = 0
|
</where>
|
</select>
|
|
<select id="selectProductByDirectionCode" resultMap="BaseResultMap">
|
select
|
<include refid="Base_Column_List"/>
|
from product
|
<where>
|
directioncode = '${directionCode}'
|
and isdel = 0
|
</where>
|
limit 1
|
</select>
|
<select id="selectProductVoByDirectionCode" resultMap="ProductVoResultMap">
|
select
|
<include refid="Base_Column_List"/>
|
from product
|
<where>
|
directioncode = '${directionCode}'
|
and isdel = 0
|
</where>
|
</select>
|
<select id="getSliceByDirectionCode" resultType="integer">
|
select
|
divideflag
|
from enterprise
|
left join product
|
on product.companynumber = enterprise.enterprisenumber
|
<where>
|
product.isdel = 0
|
and product.`directioncode` = #{directionCode}
|
</where>
|
</select>
|
<select id="selectProductInfo" resultType="com.gk.firework.Domain.ProductInfo">
|
select
|
product.id,
|
product.NAME,
|
product.directioncode,
|
product.purchaseprice,
|
<if test="companynumber != null and companynumber !=''">
|
IFNULL(productprice.price,0) as saleprice,
|
</if>
|
product.manufacturer,
|
product.specification,
|
product.explosivecontent,
|
product.type,
|
product.secondarytype,
|
product.LEVEL,
|
product.productdate,
|
product.boxnumber,
|
product.packing,
|
product.companynumber
|
from
|
product
|
<if test="companynumber != null and companynumber !=''">
|
LEFT JOIN productprice ON productprice.companynumber = #{companynumber}
|
AND productprice.itemcode = product.directioncode
|
</if>
|
<where>
|
1=1
|
and isdel = 0
|
<if test="name != null and name != ''">
|
and `name` like concat('%',#{name},'%')
|
</if>
|
|
<if test="directionCode != null and directionCode != ''">
|
and directioncode like concat('%',#{directionCode},'%')
|
</if>
|
|
<if test="manufacturer != null and manufacturer != ''">
|
and manufacturer like concat('%',#{manufacturer},'%')
|
</if>
|
|
<if test="type != null and type != ''">
|
and `type` = #{type}
|
</if>
|
<if test="secondaryType != null and secondaryType != ''">
|
and secondarytype = #{secondaryType}
|
</if>
|
</where>
|
</select>
|
|
<select id="getAllProductCodes" resultType="string">
|
select
|
directioncode
|
from product
|
<where>
|
isdel = 0
|
</where>
|
</select>
|
<select id="selectTypes" resultType="java.lang.String">
|
select type
|
from product
|
where type is not null
|
group by type
|
</select>
|
<select id="selectDoByDirections" resultType="com.gk.firework.Domain.DO.ProductDO">
|
|
select
|
product.id,
|
product.name,
|
product.directioncode,
|
product.purchaseprice,
|
product.saleprice,
|
product.manufacturer,
|
product.specification,
|
product.explosivecontent,
|
product.type,
|
product.saleprice,
|
product.manufacturer,
|
product.specification,
|
product.explosivecontent,
|
product.secondarytype,
|
product.level,
|
product.productdate,
|
product.boxnumber,
|
product.packing,
|
product.isdel,
|
product.createdby,
|
product.modifiedby,
|
product.createddate,
|
product.modifieddate,
|
product.companynumber,
|
product.isold,
|
concat('_slice',enterprise.divideflag) slice
|
from enterprise as enterprise
|
inner join product as product
|
on product.companynumber = enterprise.enterprisenumber
|
where
|
product.isdel = 0
|
and product.`directioncode`
|
in
|
<foreach collection="list" item="item" open="(" close=")">
|
#{item}
|
</foreach>
|
|
|
|
|
|
</select>
|
</mapper>
|