| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- <?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.ydtech.modules.admin.dao.CompanyDataReportMapper">
- <select id="querOrders" resultType="com.ydtech.modules.admin.model.report.company.OrdersDataDto">
- SELECT
- count( 0 ) AS "orderNumber",
- b.licenseno as "licenseno",
- b.frameno as "frameno"
- FROM
- (
- SELECT
- io.orderstatus AS orderstatus,
- io.frameno AS frameno,
- ifnull(io.licenseno, '') AS licenseno
- FROM
- ins_orders io
- LEFT JOIN sys_user su on io.userid=su.id
- <where>
- 1=1
- <if test="vo.beginDate != null and vo.beginDate!='' and vo.endDate != null and vo.endDate!=''">
- AND io.createtime BETWEEN #{vo.beginDate} AND #{vo.endDate}
- </if>
- <if test="vo.licenseno != null and vo.licenseno!='' ">
- AND io.licenseno =#{vo.licenseno}
- </if>
- <if test="vo.userId != null and vo.userId!='' ">
- AND io.userid =#{vo.userId}
- </if>
- <if test="vo.userName != null and vo.userName!='' ">
- AND su.name =#{vo.userName}
- </if>
- <if test="vo.mobile != null and vo.mobile!='' ">
- AND su.mobile =#{vo.mobile}
- </if>
- <if test="vo.frameno != null and vo.frameno!='' ">
- AND io.frameno =#{vo.frameno}
- </if>
- <if test="vo.deptId != null and vo.deptId!='' ">
- and io.deptid like concat('%', #{vo.deptId}, '%')
- </if>
- </where>
- ) b
- GROUP BY
- b.licenseno,
- b.frameno
- </select>
- <select id="querOrdersTotal" resultType="com.ydtech.modules.admin.model.report.company.OrdersDataDto">
- select
- ifnull(sum(a.orderNumber),0) as "orderNumber",
- count(a.frameno) as "frameno"
- from (
- SELECT
- count( 0 ) AS "orderNumber",
- b.licenseno as "licenseno",
- b.frameno as "frameno"
- FROM
- (
- SELECT
- io.orderstatus AS orderstatus,
- io.frameno AS frameno,
- ifnull(io.licenseno, '') AS licenseno
- FROM
- ins_orders io
- LEFT JOIN sys_user su on io.userid=su.id
- <where>
- 1=1
- <if test="vo.beginDate != null and vo.beginDate!='' and vo.endDate != null and vo.endDate!=''">
- AND io.createtime BETWEEN #{vo.beginDate} AND #{vo.endDate}
- </if>
- <if test="vo.year != null and vo.year!='' ">
- AND DATE_FORMAT( io.createtime, '%Y') =#{vo.year}
- </if>
- <if test="vo.licenseno != null and vo.licenseno!='' ">
- AND io.licenseno =#{vo.licenseno}
- </if>
- <if test="vo.userId != null and vo.userId!='' ">
- AND io.userid =#{vo.userId}
- </if>
- <if test="vo.userName != null and vo.userName!='' ">
- AND su.name =#{vo.userName}
- </if>
- <if test="vo.mobile != null and vo.mobile!='' ">
- AND su.mobile =#{vo.mobile}
- </if>
- <if test="vo.frameno != null and vo.frameno!='' ">
- AND io.frameno =#{vo.frameno}
- </if>
- <if test="vo.deptId != null and vo.deptId!='' ">
- and io.deptid like concat('%', #{vo.deptId}, '%')
- </if>
- <if test="vo.deptIds != null and vo.deptIds != '' and vo.deptIds.size() > 0">
- AND io.deptid in
- <foreach collection="vo.deptIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="vo.userIds != null and vo.userIds != '' and vo.userIds.size() > 0">
- AND io.userid in
- <foreach collection="vo.userIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- ) b
- GROUP BY
- b.licenseno,
- b.frameno ) a
- </select>
- <select id="smallQuerOrders" resultType="com.ydtech.modules.admin.model.report.company.OrdersDataDto">
- select count(0) as "orderNumber"
- from ins_area_company iac
- left join ins_orders io on io.orderno = iac.orderno
- LEFT JOIN sys_user su on io.userid=su.id
- <where>
- io.orderstatus = '3'
- and iac.orderstatus = '3'
- and io.licenseno is not null
- <if test="vo.beginDate != null and vo.beginDate!='' and vo.endDate != null and vo.endDate!=''">
- AND io.createtime BETWEEN #{vo.beginDate} AND #{vo.endDate}
- </if>
- <if test="vo.licenseno != null and vo.licenseno!='' ">
- AND io.licenseno =#{vo.licenseno}
- </if>
- <if test="vo.userId != null and vo.userId!='' ">
- AND io.userid =#{vo.userId}
- </if>
- <if test="vo.userName != null and vo.userName!='' ">
- AND su.name =#{vo.userName}
- </if>
- <if test="vo.mobile != null and vo.mobile!='' ">
- AND su.mobile =#{vo.mobile}
- </if>
- <if test="vo.frameno != null and vo.frameno!='' ">
- AND io.frameno =#{vo.frameno}
- </if>
- <if test="vo.deptId != null and vo.deptId!='' ">
- and io.deptid like concat('%', #{vo.deptId}, '%')
- </if>
- <if test="vo.year != null and vo.year!='' ">
- AND DATE_FORMAT( io.createtime, '%Y') =#{vo.year}
- </if>
- <if test="vo.deptIds != null and vo.deptIds != '' and vo.deptIds.size() > 0">
- AND io.deptid in
- <foreach collection="vo.deptIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="vo.userIds != null and vo.userIds != '' and vo.userIds.size() > 0">
- AND io.userid in
- <foreach collection="vo.userIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- </select>
- </mapper>
|