<?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.ContractDetailInfoMapper" >
|
<resultMap id="BaseResultMap" type="com.gk.firework.Domain.ContractDetailInfo" >
|
<!-- -->
|
<id column="id" property="id" jdbcType="BIGINT" />
|
<result column="ordercode" property="ordercode" jdbcType="VARCHAR" />
|
<result column="directioncode" property="directioncode" jdbcType="VARCHAR" />
|
<result column="name" property="name" jdbcType="VARCHAR" />
|
<result column="num" property="num" jdbcType="INTEGER" />
|
</resultMap>
|
<sql id="Base_Column_List" >
|
<!-- -->
|
id, ordercode, directioncode, name, num
|
</sql>
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
|
<!-- -->
|
select
|
<include refid="Base_Column_List" />
|
from contractdetail
|
where id = #{id,jdbcType=BIGINT}
|
</select>
|
<select id="selectByOrder" resultType="com.gk.firework.Domain.Vo.ProductVo">
|
SELECT
|
contractdetail.id,
|
contractdetail.directioncode,
|
contractdetail.num,
|
contractdetail.price,
|
contractdetail.changenum,
|
product.`name`,
|
product.purchaseprice,
|
product.saleprice,
|
product.specification,
|
product.explosivecontent,
|
product.type,
|
product.`level`,
|
product.productdate,
|
product.boxnumber,
|
product.packing,
|
product.manufacturer
|
FROM
|
contractdetail
|
LEFT JOIN product on product.directioncode = contractdetail.directioncode and product.isdel = 0
|
where
|
contractdetail.ordercode = #{ordercode}
|
</select>
|
<select id="selectAllDetailAtSpecificDate" resultType="com.gk.firework.Domain.ContractDetailInfo">
|
select detail.*
|
from contractorder as co
|
left join contractdetail as detail on detail.ordercode = co.ordercode
|
where
|
detail.directioncode = #{productCode}
|
and DATE(co.producedate) = DATE(#{producedate})
|
</select>
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
|
<!-- -->
|
delete from contractdetail
|
where id = #{id,jdbcType=BIGINT}
|
</delete>
|
<delete id="deleteByOrder">
|
delete from contractdetail
|
where ordercode = #{ordercode}
|
</delete>
|
<update id="updateByPrimaryKeySelective" parameterType="com.gk.firework.Domain.ContractDetailInfo" >
|
<!-- -->
|
update contractdetail
|
<set >
|
<if test="ordercode != null" >
|
ordercode = #{ordercode,jdbcType=VARCHAR},
|
</if>
|
<if test="directioncode != null" >
|
directioncode = #{directioncode,jdbcType=VARCHAR},
|
</if>
|
<if test="name != null" >
|
name = #{name,jdbcType=VARCHAR},
|
</if>
|
<if test="num != null" >
|
num = #{num,jdbcType=INTEGER},
|
</if>
|
</set>
|
where id = #{id,jdbcType=BIGINT}
|
</update>
|
<update id="updateByPrimaryKey" parameterType="com.gk.firework.Domain.ContractDetailInfo" >
|
<!-- -->
|
update contractdetail
|
set ordercode = #{ordercode,jdbcType=VARCHAR},
|
directioncode = #{directioncode,jdbcType=VARCHAR},
|
name = #{name,jdbcType=VARCHAR},
|
num = #{num,jdbcType=INTEGER}
|
where id = #{id,jdbcType=BIGINT}
|
</update>
|
<update id="updateChangNum">
|
update contractdetail
|
set changenum = changenum + #{returnNum}
|
where ordercode = #{ordercode}
|
and directioncode = #{productCode}
|
|
</update>
|
</mapper>
|