123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- <?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.pj.project.tb_business.TbBusinessMapper">
- <!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->
- <select id="getList" resultType="com.pj.project.tb_business.TbBusiness">
- select * from tb_business
- <where>
- <if test=' this.has("id") '>and id = #{id}</if>
- <if test=' this.has("customerId") '>and customer_id = #{customerId}</if>
- <if test=' this.has("customerName") '>and customer_name like concat('%', #{customerName} ,'%')</if>
- <if test=' this.has("no") '>and no = #{no}</if>
- <if test=' this.has("cardNo") '>and card_no like concat('%', #{cardNo} ,'%')</if>
- <if test=' this.has("cardSize") '>and card_size = #{cardSize}</if>
- <if test=' this.has("netWeight") '>and net_weight = #{netWeight}</if>
- <if test=' this.has("goodsName") '>and goods_name = #{goodsName}</if>
- <if test=' this.has("goodsCode") '>and goods_code = #{goodsCode}</if>
- <if test=' this.has("driverName") '>and driver_name like concat('%', #{driverName} ,'%')</if>
- <if test=' this.has("driverId") '>and driver_id = #{driverId}</if>
- <if test=' this.has("driverPhone") '>and driver_phone = #{driverPhone}</if>
- <if test=' this.has("driverIdCard") '>and driver_id_card like concat('%', #{driverIdCard} ,'%')</if>
- <if test=' this.has("expectInDay") '>and expect_in_day = #{expectInDay}</if>
- <if test=' this.has("realInDay") '>and real_in_day = #{realInDay}</if>
- <if test=' this.has("realInTime") '>and real_in_time = #{realInTime}</if>
- <if test=' this.has("payStatus") '>and pay_status = #{payStatus}</if>
- <if test=' this.has("payTime") '>and pay_time = #{payTime}</if>
- <if test=' this.has("payType") '>and pay_type = #{payType}</if>
- <if test=' this.has("outDayTime") '>and out_day_time = #{outDayTime}</if>
- <if test=' this.has("partMoney") '>and part_money = #{partMoney}</if>
- <if test=' this.has("partTime") '>and part_time = #{partTime}</if>
- <if test='isCar==0'>
- and declare_no is not null
- </if>
- <if test='isCar==1'>
- and (declare_no is null or declare_no='')
- </if>
- <if test=' this.has("current") '>
- <if test=' current == 3 '>and real_in_time is not null and out_day_time is not null</if>
- <if test=' current == 2 '>and real_in_time is not null and out_day_time is null</if>
- <if test=' current == 1 '>and real_in_time is null and out_day_time is null</if>
- </if>
- </where>
- order by
- <choose>
- <when test='sortType == 1'>id desc</when>
- <when test='sortType == 2'>customer_id desc</when>
- <when test='sortType == 3'>customer_name desc</when>
- <when test='sortType == 4'>no desc</when>
- <when test='sortType == 5'>card_no desc</when>
- <when test='sortType == 6'>card_size desc</when>
- <when test='sortType == 7'>net_weight desc</when>
- <when test='sortType == 8'>goods_name desc</when>
- <when test='sortType == 9'>goods_code desc</when>
- <when test='sortType == 10'>driver_name desc</when>
- <when test='sortType == 11'>driver_id desc</when>
- <when test='sortType == 12'>driver_phone desc</when>
- <when test='sortType == 13'>driver_id_card desc</when>
- <when test='sortType == 14'>expect_in_day desc</when>
- <when test='sortType == 15'>real_in_day desc</when>
- <when test='sortType == 16'>real_in_time desc</when>
- <when test='sortType == 17'>pay_status desc</when>
- <when test='sortType == 18'>pay_time desc</when>
- <when test='sortType == 19'>pay_type desc</when>
- <when test='sortType == 20'>out_day_time desc</when>
- <when test='sortType == 21'>part_money desc</when>
- <when test='sortType == 22'>part_time desc</when>
- <otherwise>id desc</otherwise>
- </choose>
- </select>
- <select id="getCarDisincleList" resultType="com.pj.project.tb_business.CarDisincle">
- SELECT
- a.id,
- b.id as businessCarId,
- a.`no`,a.operate_time,
- a.item_price,a.goods_name,a.admin_confirm_input,b.car_no,
- b.base_part_money,a.total_money,a.pay_money,a.create_time,
- b.real_in_time,b.real_out_time,b.car_no ,a.net_weight,a.card_size,a.pay_status,a.item_type_name
- from tb_business a,tb_business_car b
- WHERE a.business_car_id=b.id and (a.declare_no='' or a.declare_no is null)
- <if test="cardNo !='' and cardNo !=null">
- and b.car_no like concat('%',#{cardNo},'%')
- </if>
- <if test="adminConfirmInput !='-1'">
- and a.admin_confirm_input=#{adminConfirmInput}
- </if>
- <if test="customerId !=null and customerId !=''">
- and a.customer_id=#{customerId}
- </if>
- <if test="carNo !=null and carNo !=''">
- and b.car_no like concat ('%',#{carNo},'%')
- </if>
- ORDER BY a.create_time desc
- </select>
- <select id="checkCarBusinessType" resultType="java.lang.Integer">
- SELECT
- count(a.id)
- FROM
- tb_business_car a,
- tb_business b
- WHERE
- a.id = b.business_car_id
- AND a.car_no =#{carNo}
- and b.item_type_id=#{typeId}
- <if test="before==1">
- AND DATE_FORMAT( b.operate_time, '%Y-%m-%d %H:%i:%s' ) < #{operateTime}
- </if>
- <if test="before==0">
- AND DATE_FORMAT( b.operate_time, '%Y-%m-%d %H:%i:%s' ) > #{operateTime}
- </if>
- </select>
- <select id="checkCarBusinessTypeByTime" resultType="java.lang.Integer">
- SELECT
- count(b.id)
- FROM
- tb_business_car a,
- tb_business b
- WHERE
- a.id = b.business_car_id
- AND a.car_no =#{carNo}
- and b.item_type_id=#{typeId}
- AND DATE_FORMAT( b.operate_time, '%Y-%m-%d %H:%i:%s' ) > #{timeStart}
- and DATE_FORMAT( b.operate_time, '%Y-%m-%d %H:%i:%s' ) < #{timeEnd}
- <if test="businessId!=null and businessId !=''">
- and b.id !=#{businessId}
- </if>
- </select>
- </mapper>
|