bug修改
This commit is contained in:
parent
f6b3cb7946
commit
ad1d9076e1
@ -1,23 +1,31 @@
|
||||
<?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.zhgd.xmgl.modules.car.mapper.CarInfoMapper">
|
||||
<sql id="selectTable">
|
||||
SELECT if(t.car_module_type = 1 or t.car_module_type = 2, wi.id_card,
|
||||
t.outside_driver_id_card) as outsideDriverIdCard,
|
||||
if(t.car_module_type = 1 or t.car_module_type = 2, wi.worker_name,
|
||||
t.driver_worker_name) as driverWorkerName,
|
||||
t.*,
|
||||
b.car_type_name,
|
||||
ei.enterprise_name
|
||||
FROM car_info t
|
||||
LEFT JOIN car_type b ON (t.car_type = b.id and t.project_sn = b.project_sn)
|
||||
left join enterprise_info ei on ei.id = t.enterprise_id
|
||||
left join worker_info wi
|
||||
on t.driver_worker_id = wi.id and (t.car_module_type = 1 or t.car_module_type = 2)
|
||||
left join (SELECT * FROM worker_info GROUP BY id_card) wi1
|
||||
on wi1.id_card = t.outside_driver_id_card and t.car_module_type = 3
|
||||
</sql>
|
||||
<sql id="all">
|
||||
SELECT
|
||||
if(t.car_module_type=1 or t.car_module_type=2,wi.id_card,t.outside_driver_id_card) as outsideDriverIdCard,
|
||||
if(t.car_module_type=1 or t.car_module_type=2,wi.worker_name,t.driver_worker_name) as driverWorkerName,
|
||||
t.*,
|
||||
b.car_type_name,
|
||||
ei.enterprise_name
|
||||
FROM car_info t LEFT JOIN car_type b ON (t.car_type=b.id and t.project_sn=b.project_sn)
|
||||
left join enterprise_info ei on ei.id=t.enterprise_id
|
||||
left join worker_info wi on t.driver_worker_id = wi.id and (t.car_module_type=1 or t.car_module_type=2)
|
||||
left join (SELECT * FROM worker_info GROUP BY id_card) wi1 on wi1.id_card=t.outside_driver_id_card and t.car_module_type=3
|
||||
WHERE t.project_sn=#{param.projectSn}
|
||||
<include refid="com.zhgd.xmgl.modules.car.mapper.CarInfoMapper.selectTable">
|
||||
</include>
|
||||
WHERE t.project_sn = #{param.projectSn}
|
||||
<if test="param.carNumber != null and param.carNumber != ''">
|
||||
and t.car_number like CONCAT(CONCAT('%',#{param.carNumber}),'%')
|
||||
and t.car_number like CONCAT(CONCAT('%', #{param.carNumber}), '%')
|
||||
</if>
|
||||
<if test="param.isBlack != null and param.isBlack != ''">
|
||||
and t.is_black=#{param.isBlack}
|
||||
and t.is_black = #{param.isBlack}
|
||||
</if>
|
||||
<if test="param.carModuleType != null and param.carModuleType != '' and param.carModuleType != '4'.toString()">
|
||||
and t.car_module_type = #{param.carModuleType}
|
||||
@ -41,11 +49,13 @@
|
||||
</include>
|
||||
</select>
|
||||
<select id="selectCarTypeCount" resultType="java.util.Map">
|
||||
SELECT b.car_type_name carTypeName,COUNT(1) carTypeNum,
|
||||
IFNULL(SUM((CASE WHEN a.is_black=1 THEN 1 ELSE 0 END)),0) blackNum,
|
||||
IFNULL(SUM((CASE WHEN a.is_black=0 THEN 1 ELSE 0 END)),0) whiteNum
|
||||
FROM car_info a INNER JOIN car_type b ON (a.car_type=b.id and a.project_sn=b.project_sn)
|
||||
WHERE a.project_sn=#{projectSn}
|
||||
SELECT b.car_type_name carTypeName,
|
||||
COUNT(1) carTypeNum,
|
||||
IFNULL(SUM((CASE WHEN a.is_black = 1 THEN 1 ELSE 0 END)), 0) blackNum,
|
||||
IFNULL(SUM((CASE WHEN a.is_black = 0 THEN 1 ELSE 0 END)), 0) whiteNum
|
||||
FROM car_info a
|
||||
INNER JOIN car_type b ON (a.car_type = b.id and a.project_sn = b.project_sn)
|
||||
WHERE a.project_sn = #{projectSn}
|
||||
group by a.car_type
|
||||
</select>
|
||||
|
||||
@ -53,30 +63,20 @@
|
||||
select ct.car_type_name
|
||||
from car_info ci
|
||||
inner join car_type ct on ci.car_type = ct.id
|
||||
where ci.id=#{id}
|
||||
where ci.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="countCarModuleType" resultType="com.zhgd.xmgl.modules.car.entity.vo.CountCarModuleTypeVo">
|
||||
select
|
||||
ifnull(sum(if(t.car_module_type=1,1,0)),0) as gdcNum,
|
||||
ifnull(sum(if(t.car_module_type=2,1,0)),0) as cqcNum,
|
||||
ifnull(sum(if(t.car_module_type=3,1,0)),0) as lscNum
|
||||
select ifnull(sum(if(t.car_module_type = 1, 1, 0)), 0) as gdcNum,
|
||||
ifnull(sum(if(t.car_module_type = 2, 1, 0)), 0) as cqcNum,
|
||||
ifnull(sum(if(t.car_module_type = 3, 1, 0)), 0) as lscNum
|
||||
from car_info as t
|
||||
WHERE t.project_sn=#{param.projectSn}
|
||||
WHERE t.project_sn = #{param.projectSn}
|
||||
</select>
|
||||
|
||||
<select id="queryById" resultType="com.zhgd.xmgl.modules.car.entity.CarInfo">
|
||||
SELECT
|
||||
if(t.car_module_type=1 or t.car_module_type=2,wi.id_card,t.outside_driver_id_card) as outsideDriverIdCard,
|
||||
if(t.car_module_type=1 or t.car_module_type=2,wi.worker_name,t.driver_worker_name) as driverWorkerName,
|
||||
t.*,
|
||||
b.car_type_name,
|
||||
ei.enterprise_name
|
||||
FROM car_info t LEFT JOIN car_type b ON (t.car_type=b.id and t.project_sn=b.project_sn)
|
||||
left join enterprise_info ei on ei.id=t.enterprise_id
|
||||
left join worker_info wi on t.driver_worker_id = wi.id and (t.car_module_type=1 or t.car_module_type=2)
|
||||
left join (SELECT * FROM worker_info GROUP BY id_card) wi1 on wi1.id_card=t.outside_driver_id_card and
|
||||
t.car_module_type=3
|
||||
<include refid="selectTable">
|
||||
</include>
|
||||
where t.id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user