228 lines
9.5 KiB
XML
228 lines
9.5 KiB
XML
<?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.chushang.inspection.terminal.mapper.TerminalMapper">
|
|
<resultMap id="BaseResultMap" type="com.chushang.inspection.terminal.po.Terminal">
|
|
<!--@mbg.generated-->
|
|
<!--@Table st_terminal-->
|
|
<id column="terminal_id" jdbcType="BIGINT" property="terminalId"/>
|
|
<result column="dept_id" jdbcType="BIGINT" property="deptId"/>
|
|
<result column="task_id" jdbcType="BIGINT" property="taskId"/>
|
|
<result column="lower_task_id" jdbcType="BIGINT" property="lowerTaskId"/>
|
|
<result column="store_id" jdbcType="BIGINT" property="storeId"/>
|
|
<result column="store_no" jdbcType="VARCHAR" property="storeNo"/>
|
|
<result column="terminal_sn" jdbcType="VARCHAR" property="terminalSn"/>
|
|
<result column="terminal_no" jdbcType="VARCHAR" property="terminalNo"/>
|
|
<result column="terminal_type" jdbcType="TINYINT" property="terminalType"/>
|
|
<result column="terminal_model" jdbcType="VARCHAR" property="terminalModel"/>
|
|
<result column="terminal_version" jdbcType="VARCHAR" property="terminalVersion"/>
|
|
<result column="terminal_address" jdbcType="VARCHAR" property="terminalAddress"/>
|
|
<result column="terminal_source" jdbcType="TINYINT" property="terminalSource"/>
|
|
<result column="terminal_property" jdbcType="TINYINT" property="terminalProperty"/>
|
|
<result column="occupy" jdbcType="BOOLEAN" property="occupy"/>
|
|
<result column="terminal_status" jdbcType="TINYINT" property="terminalStatus"/>
|
|
<result column="remark" jdbcType="VARCHAR" property="remark"/>
|
|
<result column="version" jdbcType="BIGINT" property="version"/>
|
|
<result column="del_state" jdbcType="BOOLEAN" property="delState"/>
|
|
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
|
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
|
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
|
</resultMap>
|
|
<sql id="Base_Column_List">
|
|
<!--@mbg.generated-->
|
|
terminal_id,
|
|
dept_id,
|
|
task_id,
|
|
lower_task_id,
|
|
store_id,
|
|
store_no,
|
|
terminal_sn,
|
|
terminal_no,
|
|
terminal_type,
|
|
terminal_model,
|
|
terminal_version,
|
|
terminal_address,
|
|
terminal_source,
|
|
terminal_property,
|
|
occupy,
|
|
terminal_status,
|
|
remark,
|
|
version,
|
|
del_state,
|
|
create_by,
|
|
create_time,
|
|
update_by,
|
|
update_time
|
|
</sql>
|
|
|
|
<select id="pageList" resultType="com.chushang.inspection.terminal.vo.StoreTerminalVO">
|
|
<include refid="selectStoreTerminalSql"/>
|
|
<where>
|
|
<if test="1 == 1">
|
|
${query.sqlParam.get('sqlWhere')}
|
|
</if>
|
|
</where>
|
|
ORDER BY #{query.orderBy} #{query.isAsc}
|
|
</select>
|
|
<sql id="selectStoreTerminalSql">
|
|
SELECT pt.project_id AS projectId,
|
|
p.project_name AS projectName,
|
|
pt.id AS task_id,
|
|
pt.`name` AS taskName,
|
|
s.lower_task_id AS lowerTaskId,
|
|
s.dept_id AS deptId,
|
|
s.store_id AS storeId,
|
|
s.store_no AS storeNo,
|
|
s.store_name AS storeName,
|
|
s.store_contact AS storeContact,
|
|
s.store_phone AS storePhone,
|
|
s.shop_name AS shopName,
|
|
s.special_num AS specialNum,
|
|
s.store_address AS storeAddress,
|
|
s.store_type AS storeType,
|
|
s.products AS products,
|
|
s.tip_tool AS tipTool,
|
|
s.register_time AS registerTime,
|
|
s.register_address AS registerAddress,
|
|
s.legal_name AS legalName,
|
|
s.create_by AS createBy,
|
|
s.create_time AS createTime,
|
|
s.state AS storeState,
|
|
s.ins_fre AS insFre,
|
|
s.account_phone AS accountPhone,
|
|
s.account_manager AS accountManager,
|
|
t.terminal_id AS terminalId,
|
|
t.terminal_no AS terminalNo,
|
|
t.terminal_sn AS terminalSn,
|
|
t.terminal_type AS terminalType,
|
|
t.terminal_model AS terminalModel,
|
|
t.terminal_version AS terminalVersion,
|
|
t.terminal_address AS terminalAddress,
|
|
t.terminal_source AS terminalSource,
|
|
t.occupy AS occupy,
|
|
t.terminal_status AS terminalStatus,
|
|
ti.deviation AS deviation,
|
|
ti.operator_id AS operatorId,
|
|
ti.inspection_status AS inspectionStatus,
|
|
ti.inspection_time AS inspectionTime,
|
|
ti.times_pass AS timesPass,
|
|
ti.service_result AS serviceResult,
|
|
ti.geographic_address AS geographicAddress,
|
|
ti.geographic_location AS geographicLocation,
|
|
ti.work_location AS workLocation,
|
|
ti.work_adderss AS workAddress
|
|
FROM st_terminal t
|
|
INNER JOIN st_store s ON t.store_id = s.store_id
|
|
INNER JOIN st_terminal_ins ti ON t.terminal_id = ti.terminal_id
|
|
INNER JOIN ta_polling_task pt ON t.task_id = pt.id
|
|
INNER JOIN wrk_project p ON pt.project_id = p.project_id
|
|
</sql>
|
|
<select id="selectPageApp" resultType="com.chushang.inspection.project.vo.TerminalAppVO">
|
|
SELECT
|
|
t.terminal_id,
|
|
t.terminal_no,
|
|
t.terminal_address,
|
|
t.inspection_status,
|
|
t.inspection_time,
|
|
t.times_pass,
|
|
t.service_result,
|
|
s.store_contact,
|
|
s.store_address,
|
|
s.ins_fre,
|
|
s.store_name,
|
|
pt.`name` AS taskName
|
|
FROM
|
|
st_terminal t
|
|
LEFT JOIN ta_polling_task pt on pt.id = t.lower_task_id
|
|
INNER JOIN st_store s ON s.store_id = t.store_id
|
|
<where>
|
|
<if test="query.taskId != null">
|
|
AND t.task_id = #{query.taskId}
|
|
</if>
|
|
<if test="query.storeNo != null">
|
|
AND t.store_no = #{query.storeNo}
|
|
</if>
|
|
<if test="query.terminalNo != null">
|
|
AND t.terminal_no = #{query.terminalNo}
|
|
</if>
|
|
<if test="query.terminalSn != null">
|
|
AND t.terminal_no = #{query.terminalSn}
|
|
</if>
|
|
<if test="query.terminalAddress != null and query.terminalAddress != ''">
|
|
AND t.terminal_address like concat('%',#{query.terminalAddress},'%')
|
|
</if>
|
|
<if test="query.occupy != null ">
|
|
AND t.occupy = #{query.occupy}
|
|
</if>
|
|
<if test="query.storeState != null">
|
|
AND t.state = #{query.storeState}
|
|
</if>
|
|
<if test="query.shopName != null and query.shopName != ''">
|
|
AND s.shop_name like concat('%',#{query.shopName},'%')
|
|
</if>
|
|
<if test="query.lowerTaskName != null and query.lowerTaskName != ''">
|
|
AND pt.name like concat('%',#{query.lowerTaskName},'%')
|
|
</if>
|
|
<if test="query.storeName != null and query.storeName != ''">
|
|
AND s.store_name like concat('%',#{query.storeName},'%')
|
|
</if>
|
|
<if test="query.storeContact != null and query.storeContact != ''">
|
|
AND s.store_contact like concat('%',#{query.storeContact},'%')
|
|
</if>
|
|
<if test="query.storeAddress != null and query.storeAddress != ''">
|
|
AND s.store_address like concat('%',#{query.storeAddress},'%')
|
|
</if>
|
|
<if test="1 == 1">
|
|
${query.sqlParam.get('dataScope')}
|
|
</if>
|
|
</where>
|
|
ORDER BY t.create_time DESC
|
|
</select>
|
|
|
|
<select id="getStoreByTasKIdOrIds" resultType="com.chushang.inspection.work.dto.DispatchDTO">
|
|
select t1.terminal_id,
|
|
t1.terminal_sn,
|
|
t1.terminal_no,
|
|
t1.terminal_type,
|
|
t1.terminal_model,
|
|
t1.terminal_version,
|
|
t1.terminal_address,
|
|
t1.terminal_source,
|
|
t1.terminal_source,
|
|
t1.terminal_property,
|
|
t2.store_no,
|
|
t2.store_name,
|
|
t2.store_contact,
|
|
t2.store_phone,
|
|
t2.store_address,
|
|
t2.special_num,
|
|
t2.shop_name,
|
|
t2.store_type,
|
|
t2.products,
|
|
t2.tip_tool,
|
|
t2.ins_fre,
|
|
t2.register_address,
|
|
t2.legal_name,
|
|
t2.legal_name,
|
|
t2.legal_name,
|
|
t2.legal_name,
|
|
t2.legal_name,
|
|
t3.management_code,
|
|
t3.geographic_location,
|
|
t3.geographic_address
|
|
from st_terminal t1
|
|
left join st_store t2 on t1.store_id = t2.store_id
|
|
left join st_terminal_ins t3 on t3.terminal_id = t1.terminal_id
|
|
|
|
<where>
|
|
<if test="query.taskId != null">
|
|
AND t.task_id = #{query.taskId}
|
|
</if>
|
|
<if test="1 == 1">
|
|
${query.sqlParam.get('dataScope')}
|
|
</if>
|
|
</where>
|
|
ORDER BY t.create_time DESC
|
|
</select>
|
|
</mapper>
|