123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
- <?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.th.demo.mapping.ware.DistributionMapper" >
- <resultMap id="BaseResultMap" type="com.th.demo.model.ware.Distribution" >
- <id column="id" property="id" jdbcType="VARCHAR" />
- <result column="truck_no" property="truckNo" jdbcType="VARCHAR" />
- <result column="driver_name" property="driverName" jdbcType="VARCHAR" />
- <result column="driver_phone" property="driverPhone" jdbcType="VARCHAR" />
- <result column="sum_weight" property="sumWeight" jdbcType="DOUBLE" />
- <result column="sum_count" property="sumCount" jdbcType="DOUBLE" />
- <result column="suttle" property="suttle" jdbcType="DOUBLE" />
- <result column="out_flag" property="outFlag" jdbcType="VARCHAR" />
- <result column="add_id" property="addId" jdbcType="VARCHAR" />
- <result column="add_time" property="addTime" jdbcType="TIMESTAMP" />
- <result column="modify_id" property="modifyId" jdbcType="VARCHAR" />
- <result column="modify_time" property="modifyTime" jdbcType="TIMESTAMP" />
- <result column="cancel_id" property="cancelId" jdbcType="VARCHAR" />
- <result column="cancel_time" property="cancelTime" jdbcType="TIMESTAMP" />
- <result column="cancel_flag" property="cancelFlag" jdbcType="VARCHAR" />
- <result column="belong_id" property="belongId" jdbcType="VARCHAR" />
-
- <result column="delivery_company" property="deliveryCompany" jdbcType="VARCHAR" />
- <result column="distribution_no" property="distributionNo" jdbcType="VARCHAR" />
- <result column="tally_people" property="tallyPeople" jdbcType="VARCHAR" />
-
-
- <collection property="listDetail" column="ID" ofType="com.th.demo.model.ware.DistributionDetail"
- select="com.th.demo.mapping.ware.DistributionDetailMapper.selectByFidDist" />
-
- </resultMap>
- <sql id="Base_Column_List" >
- id, truck_no, driver_name, driver_phone, sum_weight, sum_count, suttle, out_flag,
- add_id, add_time, modify_id, modify_time, cancel_id, cancel_time, cancel_flag, belong_id,delivery_company
- </sql>
- <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
- select
- <include refid="Base_Column_List" />
- from t_ware_distribution
- where id = #{id,jdbcType=INTEGER}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
- delete from t_ware_distribution
- where id = #{id,jdbcType=INTEGER}
- </delete>
- <insert id="insert" parameterType="com.th.demo.model.ware.Distribution" >
-
- <selectKey keyProperty="id" order="BEFORE" resultType="java.lang.String">
- SELECT REPLACE(UUID(),'-','') as id from dual
- </selectKey>
-
-
- insert into t_ware_distribution (id, truck_no, driver_name,
- driver_phone, sum_weight, sum_count,
- suttle, out_flag, add_id,
- add_time, modify_id, modify_time,
- cancel_id, cancel_time, cancel_flag,
- belong_id ,delivery_company)
- values (#{id,jdbcType=VARCHAR}, #{truckNo,jdbcType=VARCHAR}, #{driverName,jdbcType=VARCHAR},
- #{driverPhone,jdbcType=VARCHAR}, #{sumWeight,jdbcType=DOUBLE}, #{sumCount,jdbcType=DOUBLE},
- 0, #{outFlag,jdbcType=VARCHAR}, #{addId,jdbcType=VARCHAR},
- #{addTime,jdbcType=TIMESTAMP}, #{modifyId,jdbcType=VARCHAR}, #{modifyTime,jdbcType=TIMESTAMP},
- #{cancelId,jdbcType=VARCHAR}, #{cancelTime,jdbcType=TIMESTAMP}, #{cancelFlag,jdbcType=VARCHAR},
- #{belongId,jdbcType=VARCHAR},#{deliveryCompany,jdbcType=VARCHAR})
- </insert>
- <insert id="insertSelective" parameterType="com.th.demo.model.ware.Distribution" >
- insert into t_ware_distribution
- <trim prefix="(" suffix=")" suffixOverrides="," >
- <if test="id != null" >
- id,
- </if>
- <if test="truckNo != null" >
- truck_no,
- </if>
- <if test="driverName != null" >
- driver_name,
- </if>
- <if test="driverPhone != null" >
- driver_phone,
- </if>
- <if test="sumWeight != null" >
- sum_weight,
- </if>
- <if test="sumCount != null" >
- sum_count,
- </if>
- <if test="suttle != null" >
- suttle,
- </if>
- <if test="outFlag != null" >
- out_flag,
- </if>
- <if test="addId != null" >
- add_id,
- </if>
- <if test="addTime != null" >
- add_time,
- </if>
- <if test="modifyId != null" >
- modify_id,
- </if>
- <if test="modifyTime != null" >
- modify_time,
- </if>
- <if test="cancelId != null" >
- cancel_id,
- </if>
- <if test="cancelTime != null" >
- cancel_time,
- </if>
- <if test="cancelFlag != null" >
- cancel_flag,
- </if>
- <if test="belongId != null" >
- belong_id,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides="," >
- <if test="id != null" >
- #{id,jdbcType=INTEGER},
- </if>
- <if test="truckNo != null" >
- #{truckNo,jdbcType=INTEGER},
- </if>
- <if test="driverName != null" >
- #{driverName,jdbcType=VARCHAR},
- </if>
- <if test="driverPhone != null" >
- #{driverPhone,jdbcType=VARCHAR},
- </if>
- <if test="sumWeight != null" >
- #{sumWeight,jdbcType=DOUBLE},
- </if>
- <if test="sumCount != null" >
- #{sumCount,jdbcType=DOUBLE},
- </if>
- <if test="suttle != null" >
- #{suttle,jdbcType=DOUBLE},
- </if>
- <if test="outFlag != null" >
- #{outFlag,jdbcType=VARCHAR},
- </if>
- <if test="addId != null" >
- #{addId,jdbcType=VARCHAR},
- </if>
- <if test="addTime != null" >
- #{addTime,jdbcType=TIMESTAMP},
- </if>
- <if test="modifyId != null" >
- #{modifyId,jdbcType=VARCHAR},
- </if>
- <if test="modifyTime != null" >
- #{modifyTime,jdbcType=TIMESTAMP},
- </if>
- <if test="cancelId != null" >
- #{cancelId,jdbcType=VARCHAR},
- </if>
- <if test="cancelTime != null" >
- #{cancelTime,jdbcType=TIMESTAMP},
- </if>
- <if test="cancelFlag != null" >
- #{cancelFlag,jdbcType=VARCHAR},
- </if>
- <if test="belongId != null" >
- #{belongId,jdbcType=VARCHAR},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.th.demo.model.ware.Distribution" >
- update t_ware_distribution
- <set >
- <if test="truckNo != null" >
- truck_no = #{truckNo,jdbcType=INTEGER},
- </if>
- <if test="driverName != null" >
- driver_name = #{driverName,jdbcType=VARCHAR},
- </if>
- <if test="driverPhone != null" >
- driver_phone = #{driverPhone,jdbcType=VARCHAR},
- </if>
- <if test="sumWeight != null" >
- sum_weight = #{sumWeight,jdbcType=DOUBLE},
- </if>
- <if test="sumCount != null" >
- sum_count = #{sumCount,jdbcType=DOUBLE},
- </if>
- <if test="suttle != null" >
- suttle = #{suttle,jdbcType=DOUBLE},
- </if>
- <if test="outFlag != null" >
- out_flag = #{outFlag,jdbcType=VARCHAR},
- </if>
- <if test="addId != null" >
- add_id = #{addId,jdbcType=VARCHAR},
- </if>
- <if test="addTime != null" >
- add_time = #{addTime,jdbcType=TIMESTAMP},
- </if>
- <if test="modifyId != null" >
- modify_id = #{modifyId,jdbcType=VARCHAR},
- </if>
- <if test="modifyTime != null" >
- modify_time = #{modifyTime,jdbcType=TIMESTAMP},
- </if>
- <if test="cancelId != null" >
- cancel_id = #{cancelId,jdbcType=VARCHAR},
- </if>
- <if test="cancelTime != null" >
- cancel_time = #{cancelTime,jdbcType=TIMESTAMP},
- </if>
- <if test="cancelFlag != null" >
- cancel_flag = #{cancelFlag,jdbcType=VARCHAR},
- </if>
- <if test="belongId != null" >
- belong_id = #{belongId,jdbcType=VARCHAR},
- </if>
- </set>
- where id = #{id,jdbcType=INTEGER}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.th.demo.model.ware.Distribution" >
- update t_ware_distribution
- set truck_no = #{truckNo,jdbcType=VARCHAR},
- driver_name = #{driverName,jdbcType=VARCHAR},
- driver_phone = #{driverPhone,jdbcType=VARCHAR},
- sum_weight = #{sumWeight,jdbcType=DOUBLE},
- sum_count = #{sumCount,jdbcType=DOUBLE},
- suttle = #{suttle,jdbcType=DOUBLE},
- out_flag = #{outFlag,jdbcType=VARCHAR},
- add_id = #{addId,jdbcType=VARCHAR},
- add_time = #{addTime,jdbcType=TIMESTAMP},
- modify_id = #{modifyId,jdbcType=VARCHAR},
- modify_time = #{modifyTime,jdbcType=TIMESTAMP},
- cancel_id = #{cancelId,jdbcType=VARCHAR},
- cancel_time = #{cancelTime,jdbcType=TIMESTAMP},
- cancel_flag = #{cancelFlag,jdbcType=VARCHAR},
- belong_id = #{belongId,jdbcType=VARCHAR},
- delivery_company = #{deliveryCompany,jdbcType=VARCHAR},
- distribution_no =ifnull(distribution_no,(select dis_no from (select concat('ZG',DATE_FORMAT(NOW(), '%Y%m%d'),IFNULL(lpad(max(substring(t.distribution_no,11,3)+1),3,'0'),'001')) as dis_no from t_ware_distribution t
- where substring(t.distribution_no,3,8) = DATE_FORMAT(NOW(), '%Y%m%d')) temp))
- ,tally_people = #{tallyPeople,jdbcType=VARCHAR}
- where id = #{id,jdbcType=VARCHAR}
- </update>
-
-
-
- <select id="selectWaitTrucks" resultMap="BaseResultMap" >
- select t.* from t_ware_distribution t
- where ifnull(t.out_flag,'0') = '0'
- and t.belong_id=#{param2,jdbcType=VARCHAR}
- order by t.add_time desc
- </select>
-
- <select id="selectByTruckNo" resultMap="BaseResultMap" >
- select t.* from t_ware_distribution t
- where ifnull(t.out_flag,'0') = '0'
- and t.truck_no = #{param1,jdbcType=VARCHAR}
- and t.belong_id = #{param2,jdbcType=VARCHAR}
- order by t.add_time desc
- </select>
-
- <select id="selectByDisNo" resultMap="BaseResultMap" >
- select t.* from t_ware_distribution t
- where ifnull(t.out_flag,'0') = '0'
- and t.distribution_no = #{param1,jdbcType=VARCHAR}
- and t.belong_id = #{param2,jdbcType=VARCHAR}
- order by t.add_time desc
- </select>
-
- </mapper>
|