<?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.stylefeng.guns.modular.system.dao.TLineMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.TLine">
|
<id column="id" property="id" />
|
<result column="name" property="name" />
|
<result column="shiftInterval" property="shiftInterval" />
|
<result column="rakeRate" property="rakeRate" />
|
<result column="state" property="state" />
|
<result column="insertTime" property="insertTime" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id, name, shiftInterval, rakeRate, state, insertTime
|
</sql>
|
|
<!--根据条件查询线路列表-->
|
<select id="getLineList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page">
|
SELECT * FROM (SELECT model.modelStr,IFNULL(ls.num,0) as shiftNum,su.`name` as insertUser,IFNULL(lc.num,0) as companyNum,ll.* FROM t_line as ll
|
LEFT JOIN (
|
SELECT GROUP_CONCAT(sc.`name` SEPARATOR '、') as modelStr,lp.lineId FROM t_line_price as lp
|
LEFT JOIN t_server_carmodel as sc on sc.id = lp.serverCarModelId
|
where sc.type = 2 and lp.state != 3 GROUP BY lp.lineId) as model on model.lineId = ll.id
|
LEFT JOIN (SELECT COUNT(id) as num,lineId FROM t_line_shift where state != 3 GROUP BY lineId) as ls on ls.lineId = ll.id
|
LEFT JOIN sys_user as su on su.id = ll.insertUserId
|
LEFT JOIN (SELECT COUNT(id) as num,lineId FROM t_line_company GROUP BY lineId) as lc on lc.lineId = ll.id
|
) as o
|
<where>
|
o.state != 3
|
<if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
|
AND (o.insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
|
</if>
|
<if test="name != null and name != ''">
|
and o.name LIKE CONCAT('%',#{name},'%')
|
</if>
|
<if test="insertUser != null and insertUser != ''">
|
and o.insertUser LIKE CONCAT('%',#{insertUser},'%')
|
</if>
|
<if test="modelStr != null and modelStr != ''">
|
and o.modelStr LIKE CONCAT('%',#{modelStr},'%')
|
</if>
|
<if test="state != null and state != ''">
|
and o.state = #{state}
|
</if>
|
</where>
|
order by o.id desc
|
</select>
|
|
<!--根据线路ID查询线路价格-->
|
<select id="getLinePriceList" resultType="java.util.Map">
|
SELECT sc.`name`,lp.* FROM t_line_price as lp
|
LEFT JOIN t_server_carmodel as sc on sc.id = lp.serverCarModelId
|
where lp.lineId = #{lineId} and lp.state != 3
|
</select>
|
|
<!--根据线路ID查询线路已分配公司-->
|
<select id="getLineCompanyList" resultType="java.util.Map">
|
SELECT cc.`name` as companyName,lc.* FROM t_line_company as lc
|
LEFT JOIN t_company as cc on cc.id = lc.companyId
|
where lc.lineId = #{lineId}
|
</select>
|
|
</mapper>
|