Commit 1771d2de authored by helinlin's avatar helinlin

增加防火监督检查记录照片查看

parent 0fe04b5e
......@@ -586,4 +586,14 @@ public class CheckController extends AbstractBaseController {
return CommonResponseUtil.success(page);
}
/**
* 根据检查记录查询照片
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "根据检查记录查询照片", notes = "根据检查记录查询照片")
@RequestMapping(value = "/getPictureByCheckId", method = RequestMethod.GET)
public CommonResponse getPictureByCheckId(@ApiParam(value = "检查记录ID") @RequestParam String checkId) {
List<String> pictures = checkService.getPictureByCheckId(checkId);
return CommonResponseUtil.success(pictures);
}
}
......@@ -295,4 +295,6 @@ public interface CheckMapper extends BaseMapper {
long queryPageCount(CheckPageParam param);
List<CheckVo> queryPage(CheckPageParam param);
List<String> getPictureByCheckId(String checkId);
}
......@@ -1577,7 +1577,7 @@ public class CheckServiceImpl implements ICheckService {
Plan plan = planService.queryPlanById(planTask.getPlanId());
// 计划完成,规则推送消息
if (PlanStatusEnum.COMPLETED.getValue() == plan.getStatus()){
if (PlanStatusEnum.COMPLETED.getValue() == plan.getStatus()) {
rulePlanService.addPlanRule(plan, null, RuleTypeEnum.计划完成);
}
......@@ -1685,5 +1685,8 @@ public class CheckServiceImpl implements ICheckService {
return result;
}
@Override
public List<String> getPictureByCheckId(String checkId) {
return checkMapper.getPictureByCheckId(checkId);
}
}
......@@ -282,4 +282,6 @@ public interface ICheckService {
int checkHasRecord(Long planTaskId, Long pointId);
Page<CheckVo> queryPage(CheckPageParam criterias);
List<String> getPictureByCheckId(String checkId);
}
......@@ -9,7 +9,10 @@ import java.util.Date;
*/
@Data
public class CheckVo {
/**
* checkId
*/
private Long checkId;
/**
* 主键id
*/
......
......@@ -51,7 +51,7 @@
<if test="catalogId!=null">and b.Catalog_Id = #{catalogId}</if>
<if test="orgCode!=null">and (a.org_Code like concat (#{orgCode},"-%")or a.org_Code= #{orgCode})</if>
<if test="pointId!=null">and a.point_id = #{pointId}</if>
<if test="departmentId!=null and departmentId!='-1'"> and find_in_set(#{departmentId}, a.dep_id) > 0</if>
<if test="departmentId!=null and departmentId!='-1'">and find_in_set(#{departmentId}, a.dep_id) > 0</if>
<choose>
<when test="finishStatus == 0">and (`a`.`plan_task_detail_id` = 0 OR `a`.`plan_task_detail_id` is
null)
......@@ -92,7 +92,7 @@
THEN '2'
END
) AS `Finish_Status`,
a.is_ok is_ok,
a.is_ok is_ok,
a.score,
d.`name` AS `route_name`,
a.check_mode,
......@@ -109,7 +109,8 @@
LEFT JOIN `p_route` `d` ON `a`.`route_id` = `d`.`id`
LEFT JOIN `p_plan` `e` ON `a`.`plan_id` = `e`.`id`
<if test="dangerId != null and dangerId != ''">
LEFT JOIN ( SELECT check_id, GROUP_CONCAT( latent_danger_id ) dangerIds FROM p_latent_danger_patrol GROUP BY check_id ) t ON t.check_id = a.id
LEFT JOIN ( SELECT check_id, GROUP_CONCAT( latent_danger_id ) dangerIds FROM p_latent_danger_patrol GROUP BY
check_id ) t ON t.check_id = a.id
</if>
<trim prefix="WHERE" prefixOverrides="AND ">
<if test="beginDate!=null and endDate!=null">and a.check_time BETWEEN #{beginDate} and #{endDate}</if>
......@@ -127,7 +128,7 @@
<if test="orgCode!=null">and (a.org_Code like concat (#{orgCode},"-%")or a.org_Code= #{orgCode})</if>
<if test="pointId!=null">and a.point_id = #{pointId}</if>
<if test="checkTime!=null">and TO_DAYS(a.check_time) = TO_DAYS('${checkTime}')</if>
<if test="departmentId!=null and departmentId!='-1'"> and find_in_set(#{departmentId}, a.dep_id) > 0</if>
<if test="departmentId!=null and departmentId!='-1'">and find_in_set(#{departmentId}, a.dep_id) > 0</if>
<if test="checkType == '计划检查'">and a.plan_task_id &gt; 0</if>
<if test="checkType == '无计划检查'">and a.plan_task_id &lt;= 0</if>
<choose>
......@@ -211,7 +212,8 @@
order by ci.order_no
</select>
<select id="findCheckPointInputItem" resultType="com.yeejoin.amos.supervision.business.entity.mybatis.PointCheckDetailBo"
<select id="findCheckPointInputItem"
resultType="com.yeejoin.amos.supervision.business.entity.mybatis.PointCheckDetailBo"
parameterType="long">
SELECT
pp.id pointId,
......@@ -250,16 +252,16 @@
order by pci.order_no
</select>
<!-- <select id="checkHasRecord" resultType="int">-->
<!-- SELECT-->
<!-- count(1) num-->
<!-- FROM-->
<!-- p_check c-->
<!-- WHERE-->
<!-- is_ok in (1,2)-->
<!-- and c.point_id = #{pointId}-->
<!-- and c.plan_task_id = #{planTaskId}-->
<!-- </select>-->
<!-- <select id="checkHasRecord" resultType="int">-->
<!-- SELECT-->
<!-- count(1) num-->
<!-- FROM-->
<!-- p_check c-->
<!-- WHERE-->
<!-- is_ok in (1,2)-->
<!-- and c.point_id = #{pointId}-->
<!-- and c.plan_task_id = #{planTaskId}-->
<!-- </select>-->
<select id="pieChartData" resultType="Map">
SELECT
......@@ -334,7 +336,7 @@
<if test="orgCode!=null">AND (c.org_code LIKE concat(#{orgCode},"-%") or c.org_code = #{orgCode})</if>
<if test="departmentId!=null">AND FIND_IN_SET(#{departmentId}, c.dep_id) > 0</if>
<if test="userId != null and userId != '' ">
AND FIND_IN_SET(#{userId}, c.user_id) > 0
AND FIND_IN_SET(#{userId}, c.user_id) > 0
</if>
<if test="planId != null and planId != '' ">
AND c.plan_id = #{planId}
......@@ -475,7 +477,7 @@
<when test="finishStatus == 1">and (`a`.`plan_task_detail_id` != 0 AND `a`.`is_ok` != 3)</when>
<when test="finishStatus == 2">and `a`.`is_ok` = 3</when>
</choose>
<if test="departmentId!=null"> and find_in_set(#{departmentId},a.dep_id)>0 </if>
<if test="departmentId!=null">and find_in_set(#{departmentId},a.dep_id)>0</if>
</trim>
</select>
......@@ -658,12 +660,12 @@
sum(missed_check_num) forNum
FROM
p_plan_exec_statistics
<where>
<if test="orgCode!=null">AND LOCATE(#{orgCode}, org_Code) <![CDATA[>]]>0</if>
<if test="userId !=null">and user_id = #{userId}</if>
AND check_time <![CDATA[>=]]> #{startDate}
AND check_time <![CDATA[<=]]> #{endDate}
</where>
<where>
<if test="orgCode!=null">AND LOCATE(#{orgCode}, org_Code) <![CDATA[>]]>0</if>
<if test="userId !=null">and user_id = #{userId}</if>
AND check_time <![CDATA[>=]]> #{startDate}
AND check_time <![CDATA[<=]]> #{endDate}
</where>
GROUP BY check_time
) fa
......@@ -795,12 +797,13 @@
FROM
p_point_classify classify
<where>
classify.id IN ( SELECT pci.point_classify_id FROM p_check_input pci WHERE <if test="checkID != null">pci.check_id = #{checkID}</if> )
classify.id IN ( SELECT pci.point_classify_id FROM p_check_input pci WHERE <if test="checkID != null">
pci.check_id = #{checkID}
</if> )
</where>
</select>
<!-- 根据巡检记录ID和巡检点ID获取巡检项信息 -->
<select id="getCheckInputByCheckId" resultMap="checkInputResultMap">
SELECT
......@@ -831,32 +834,33 @@
LEFT JOIN p_input_item ii ON ci.input_id = ii.id
LEFT JOIN p_check c ON ci.check_id = c.id
<where>
<if test="checkID != null">
AND ci.check_id = #{checkID}
</if>
<if test="pointID != null">
AND c.point_id = #{pointID}
</if>
<if test="checkID != null">
AND ci.check_id = #{checkID}
</if>
<if test="pointID != null">
AND c.point_id = #{pointID}
</if>
</where>
</select>
<!-- 根据巡检记录ID和巡检点ID获取巡检项信息 -->
<select id="getCheckEquipByCheckID" resultType="java.util.HashMap" parameterType="java.lang.Long">
SELECT
classify.id as classifyId,
classify.id as classifyId,
classify.name as equipmentName,
classify.equipment_id as equipmentId,
(SELECT create_date FROM p_check WHERE id = #{checkID}) as createDate
FROM
p_point_classify classify
WHERE
classify.id IN (
SELECT
pci.point_classify_id
FROM p_check_input pci WHERE
<if test="pointID != null">
pci.check_id = #{checkID}
</if> )
classify.id IN (
SELECT
pci.point_classify_id
FROM p_check_input pci WHERE
<if test="pointID != null">
pci.check_id = #{checkID}
</if>
)
</select>
<!-- 根据巡检记录ID和巡检点ID获取巡检项信息 -->
<select id="getEquipInputByCheckId" resultType="java.util.HashMap">
......@@ -899,7 +903,7 @@
AND c.point_id = #{pointID}
</if>
<if test="classifyId != null">
AND ci.point_classify_id = #{classifyId}
AND ci.point_classify_id = #{classifyId}
</if>
</where>
</select>
......@@ -937,7 +941,7 @@
<!-- 根据巡检记录ID和巡检点ID获取巡检详情 -->
<select id="getCheckDetailByID" resultMap="checkDetailResultMap">
SELECT
SELECT
c.user_id AS userId,
c.dep_id AS depId,
c.check_time AS CheckTime,
......@@ -975,12 +979,12 @@
LEFT JOIN p_plan pl ON c.plan_id = pl.id
LEFT JOIN p_route r ON r.id = c.route_id
<where>
<if test="checkID != null and checkID!= -1">
AND c.id = #{checkID}
</if>
<if test="pointID != null">
AND c.point_id = #{pointID}
</if>
<if test="checkID != null and checkID!= -1">
AND c.id = #{checkID}
</if>
<if test="pointID != null">
AND c.point_id = #{pointID}
</if>
</where>
ORDER BY
c.check_time DESC
......@@ -1092,7 +1096,8 @@
<!-- 风险点最新巡检信息查询,3d屏使用 -->
<resultMap id="planRoutePointResultMap" type="com.yeejoin.amos.supervision.business.entity.mybatis.PlanRoutePointBo">
<resultMap id="planRoutePointResultMap"
type="com.yeejoin.amos.supervision.business.entity.mybatis.PlanRoutePointBo">
<result property="routeName" column="route_name"/>
<result property="planName" column="plan_name"/>
<result property="deptName" column="department_name"/>
......@@ -1189,7 +1194,7 @@
) sa
<where>
c.plan_id = sa.id
<if test="userId != null">AND find_in_set(#{userId}, sa.user_id) >0 </if>
<if test="userId != null">AND find_in_set(#{userId}, sa.user_id) >0</if>
<if test="checkDate != null">AND DATE_FORMAT(c.check_time, '%Y%m%d') = DATE_FORMAT(#{checkDate}, '%Y%m%d')
</if>
</where>
......@@ -1218,13 +1223,13 @@
a.route_id AS routeID,
b.name AS name,
(SELECT
GROUP_CONCAT(
`name`
)
FROM
s_user u
WHERE
find_in_set(u.id,a.user_id)>0 ) AS realName,
GROUP_CONCAT(
`name`
)
FROM
s_user u
WHERE
find_in_set(u.id,a.user_id)>0 ) AS realName,
a.id AS planID
FROM
p_plan a,
......@@ -1235,7 +1240,7 @@
) sa
WHERE
d.plan_id = sa.planID
<if test="userId != null">AND find_in_set(#{userId}, sa.userID)>0 </if>
<if test="userId != null">AND find_in_set(#{userId}, sa.userID)>0</if>
<if test="checkDate != null">AND DATE_FORMAT(d.check_time, '%y%m%d') = #{checkDate}</if>
ORDER BY d.id DESC
) temp_row
......@@ -1523,7 +1528,7 @@
a.checkMonth
</when>
</choose> -->
select
select
<choose>
<when test=" statisticsTyle == 0 ">
a.planName name,
......@@ -1571,7 +1576,7 @@
pt.id pointId,
c.user_id userName,
c.dep_id deptName,
c.user_id userId,
c.user_id userId,
c.dep_id departmentId,
c.score,
c.id checkId,
......@@ -1612,7 +1617,7 @@
LEFT JOIN p_point pt ON c.point_id = pt.id
WHERE 1=1
<if test="orgCode!=null">
and (c.org_code LIKE CONCAT( #{orgCode}, '-%' ) or c.org_code= #{orgCode} )
and (c.org_code LIKE CONCAT( #{orgCode}, '-%' ) or c.org_code= #{orgCode} )
</if>
<choose>
<when test=" statisticsTyle == 1 ">
......@@ -1685,110 +1690,110 @@
ADDDATE(#{startTime} , INTERVAL @d DAY)<![CDATA[ < ]]> DATE_FORMAT(#{endTime}, '%Y-%m-%d')
) d LEFT JOIN p_check c ON DATE_FORMAT(c.check_time, '%Y-%m-%d') = d.date
<if test=" orgCode != null and orgCode != '' ">and position( #{orgCode} in c.org_code )</if>
<if test=" userId != null and userId != '' ">and find_in_set(#{userId}, c.user_id)>0 </if>
<if test=" userId != null and userId != '' ">and find_in_set(#{userId}, c.user_id)>0</if>
<if test="type == 1">and c.is_ok != #{param}</if>
<if test="type == 2">and c.plan_id != #{param}</if>
<if test="type == 3">and c.is_ok = #{param}</if>
<where>
<if test="startTime !=null and startTime!= '' "> <![CDATA[ AND d.date >= #{startTime} ]]> </if>
<if test="endTime !=null and endTime!='' "><![CDATA[AND d.date < #{endTime} ]]></if>
<if test="startTime !=null and startTime!= '' "> <![CDATA[ AND d.date >= #{startTime} ]]> </if>
<if test="endTime !=null and endTime!='' "><![CDATA[AND d.date < #{endTime} ]]></if>
</where>
group by d.date
order BY d.date
</select>
<!-- 巡检记录查询 -->
<!-- <select id="getCheckInfoList1" resultMap="CheckInfoResultMap">-->
<!-- select * from (-->
<!-- SELECT-->
<!-- DATE_FORMAT(c.check_time, '%Y-%m-%d %T') as checkTime,-->
<!-- c.user_id as UserID,-->
<!-- c.point_id as PointID,-->
<!-- c.id as CheckID,-->
<!-- c.is_ok as IsOK,-->
<!-- c.error as ErrorMsg,-->
<!-- c.plan_task_id as ErrorID,-->
<!-- p.name as pointName,-->
<!-- c.dep_name as NAME,-->
<!-- c.dep_id as GroupID,-->
<!-- c.user_name as RealName,-->
<!-- (SELECT-->
<!-- GROUP_CONCAT(-->
<!-- IFNULL(case when u.mobile = '' or u.mobile is null then null else u.mobile END,u.telephone)-->
<!-- )-->
<!-- FROM-->
<!-- s_user u-->
<!-- WHERE-->
<!-- find_in_set(u.id,c.user_id)>0) as LoginName,-->
<!-- c.org_code as orgCode-->
<!-- FROM-->
<!-- p_check c,-->
<!-- p_point p-->
<!-- where-->
<!-- p.id =c.point_id ) as a-->
<!-- <trim prefix="WHERE" prefixOverrides="AND ">-->
<!-- <if test="pointID!=null">AND a.PointID = #{pointID}</if>-->
<!-- <if test="checkTime!=null">AND DATE_FORMAT(a.CheckTime, '%Y%m%d') = #{checkTime}</if>-->
<!-- <if test="userID!=null and userID!=-1 ">AND find_in_set(#{userID}, a.userID)>0 </if>-->
<!-- <if test="status!=null">AND a.IsOK = #{status}</if>-->
<!-- <if test="userName!=null">AND a.RealName LIKE concat(concat("%",#{userName}),"%")</if>-->
<!-- <if test="groupId!=null">AND find_in_set(#{groupId}, a.GroupID)>0</if>-->
<!-- <if test="pointName!=null">AND a.pointName LIKE concat(concat("%",#{pointName}),"%")</if>-->
<!-- <if test="orgCode!=null">AND a.orgCode LIKE #{orgCode}</if>-->
<!-- </trim>-->
<!-- <choose>-->
<!-- <when test="pageSize==-1"></when>-->
<!-- <when test="pageSize!=-1">limit #{offset},#{pageSize}</when>-->
<!-- </choose>-->
<!-- </select>!&ndash;&gt;-->
<!-- <select id="getCheckInfoList1" resultMap="CheckInfoResultMap">-->
<!-- select * from (-->
<!-- SELECT-->
<!-- DATE_FORMAT(c.check_time, '%Y-%m-%d %T') as checkTime,-->
<!-- c.user_id as UserID,-->
<!-- c.point_id as PointID,-->
<!-- c.id as CheckID,-->
<!-- c.is_ok as IsOK,-->
<!-- c.error as ErrorMsg,-->
<!-- c.plan_task_id as ErrorID,-->
<!-- p.name as pointName,-->
<!-- c.dep_name as NAME,-->
<!-- c.dep_id as GroupID,-->
<!-- c.user_name as RealName,-->
<!-- (SELECT-->
<!-- GROUP_CONCAT(-->
<!-- IFNULL(case when u.mobile = '' or u.mobile is null then null else u.mobile END,u.telephone)-->
<!-- )-->
<!-- FROM-->
<!-- s_user u-->
<!-- WHERE-->
<!-- find_in_set(u.id,c.user_id)>0) as LoginName,-->
<!-- c.org_code as orgCode-->
<!-- FROM-->
<!-- p_check c,-->
<!-- p_point p-->
<!-- where-->
<!-- p.id =c.point_id ) as a-->
<!-- <trim prefix="WHERE" prefixOverrides="AND ">-->
<!-- <if test="pointID!=null">AND a.PointID = #{pointID}</if>-->
<!-- <if test="checkTime!=null">AND DATE_FORMAT(a.CheckTime, '%Y%m%d') = #{checkTime}</if>-->
<!-- <if test="userID!=null and userID!=-1 ">AND find_in_set(#{userID}, a.userID)>0 </if>-->
<!-- <if test="status!=null">AND a.IsOK = #{status}</if>-->
<!-- <if test="userName!=null">AND a.RealName LIKE concat(concat("%",#{userName}),"%")</if>-->
<!-- <if test="groupId!=null">AND find_in_set(#{groupId}, a.GroupID)>0</if>-->
<!-- <if test="pointName!=null">AND a.pointName LIKE concat(concat("%",#{pointName}),"%")</if>-->
<!-- <if test="orgCode!=null">AND a.orgCode LIKE #{orgCode}</if>-->
<!-- </trim>-->
<!-- <choose>-->
<!-- <when test="pageSize==-1"></when>-->
<!-- <when test="pageSize!=-1">limit #{offset},#{pageSize}</when>-->
<!-- </choose>-->
<!-- </select>!&ndash;&gt;-->
<select id="getCheckInfoList1" resultType="Map">
select
c.id as checkID,
c.dep_name as name,
c.dep_id as groupID,
c.user_name as realName,
c.org_code as orgCode,
c.user_id as userID,
c.point_id as pointID,
c.is_ok as isOK,
c.error as errorMsg,
c.plan_task_id as errorID,
date_format(c.check_time, '%Y-%m-%d %T') as checkTime,
p.name as pointName
c.id as checkID,
c.dep_name as name,
c.dep_id as groupID,
c.user_name as realName,
c.org_code as orgCode,
c.user_id as userID,
c.point_id as pointID,
c.is_ok as isOK,
c.error as errorMsg,
c.plan_task_id as errorID,
date_format(c.check_time, '%Y-%m-%d %T') as checkTime,
p.name as pointName
from
p_check c,
p_point p
p_check c,
p_point p
where c.point_id = p.id
<if test="pointID!=null">AND c.point_id = #{pointID}</if>
<if test="checkTime!=null">AND DATE_FORMAT(c.check_time, '%Y%m%d') = #{checkTime}</if>
<if test="userID!=null and userID!=-1 ">AND find_in_set(#{userID}, c.user_id)>0 </if>
<if test="status!=null">AND c.is_ok = #{status}</if>
<if test="userName!=null">AND c.error LIKE concat(concat("%",#{userName}),"%")</if>
<if test="groupId!=null">AND find_in_set(#{groupId}, c.dep_id)>0</if>
<if test="pointName!=null">AND p.name LIKE concat(concat("%",#{pointName}),"%")</if>
<if test="orgCode!=null">AND c.org_code LIKE #{orgCode}</if>
<if test="pointID!=null">AND c.point_id = #{pointID}</if>
<if test="checkTime!=null">AND DATE_FORMAT(c.check_time, '%Y%m%d') = #{checkTime}</if>
<if test="userID!=null and userID!=-1 ">AND find_in_set(#{userID}, c.user_id)>0</if>
<if test="status!=null">AND c.is_ok = #{status}</if>
<if test="userName!=null">AND c.error LIKE concat(concat("%",#{userName}),"%")</if>
<if test="groupId!=null">AND find_in_set(#{groupId}, c.dep_id)>0</if>
<if test="pointName!=null">AND p.name LIKE concat(concat("%",#{pointName}),"%")</if>
<if test="orgCode!=null">AND c.org_code LIKE #{orgCode}</if>
order by c.create_date DESC
<choose>
<when test="pageSize==-1"></when>
<when test="pageSize!=-1">limit #{offset},#{pageSize}</when>
</choose>
</select>
<!-- 巡检记录统计 -->
<select id="countCheckInfoListData1" resultType="long">
select
count(1)
count(1)
from
p_check c,
p_point p
p_check c,
p_point p
where c.point_id = p.id
<if test="pointID!=null">AND c.point_id = #{pointID}</if>
<if test="checkTime!=null">AND DATE_FORMAT(c.check_time, '%Y%m%d') = #{checkTime}</if>
<if test="userID!=null and userID!=-1 ">AND find_in_set(#{userID}, c.user_id)>0 </if>
<if test="userID!=null and userID!=-1 ">AND find_in_set(#{userID}, c.user_id)>0</if>
<if test="status!=null">AND c.is_ok = #{status}</if>
<if test="userName!=null">AND c.user_name LIKE concat(concat("%",#{userName}),"%")</if>
<if test="groupId!=null">AND find_in_set(#{groupId}, c.dep_id)>0</if>
......@@ -1883,11 +1888,11 @@
) d
LEFT JOIN p_plan_task c ON DATE_FORMAT(c.check_date, '%Y-%m-%d') = d.date
<if test="orgCode !=null and orgCode!='' ">
AND (c.org_code=#{orgCode} or c.org_code like CONCAT(#{orgCode},'-%'))
AND (c.org_code=#{orgCode} or c.org_code like CONCAT(#{orgCode},'-%'))
</if>
WHERE 1=1
<if test="startTime !=null and startTime!= '' "> AND d.date <![CDATA[ >= ]]> #{startTime}</if>
<if test="endTime !=null and endTime!='' "> AND d.date <![CDATA[ < ]]> #{endTime} </if>
WHERE 1=1
<if test="startTime !=null and startTime!= '' ">AND d.date <![CDATA[ >= ]]> #{startTime}</if>
<if test="endTime !=null and endTime!='' ">AND d.date <![CDATA[ < ]]> #{endTime}</if>
GROUP BY
d.date
ORDER BY
......@@ -1896,22 +1901,22 @@
<select id="getItemCount" resultType="long">
SELECT
count(1)
count(1)
FROM
p_input_item pii
LEFT JOIN p_point_inputitem ppi ON pii.id = ppi.input_item_id
LEFT JOIN p_route_point_item prpi ON prpi.point_input_item_id = ppi.id
LEFT JOIN p_route_point prp ON prp.id = prpi.route_point_id AND prp.point_id = ppi.point_id
LEFT JOIN p_check_input pci ON pci.route_point_item_id = prpi.id
LEFT JOIN p_point pp ON ppi.point_id =pp.id
p_input_item pii
LEFT JOIN p_point_inputitem ppi ON pii.id = ppi.input_item_id
LEFT JOIN p_route_point_item prpi ON prpi.point_input_item_id = ppi.id
LEFT JOIN p_route_point prp ON prp.id = prpi.route_point_id AND prp.point_id = ppi.point_id
LEFT JOIN p_check_input pci ON pci.route_point_item_id = prpi.id
LEFT JOIN p_point pp ON ppi.point_id =pp.id
WHERE
prp.route_id = #{routeId}
<if test="pointId != null and pointId != '' and pointId != -1">
AND ppi.point_id = #{pointId}
</if>
prp.route_id = #{routeId}
<if test="pointId != null and pointId != '' and pointId != -1">
AND ppi.point_id = #{pointId}
</if>
<choose>
<when test="status != null and status != '' and status==0">
AND pci.id IS NULL
AND pci.id IS NULL
</when>
<when test="status != null and status != '' and status==1">
AND pci.id IS NOT NULL
......@@ -1924,43 +1929,43 @@
<select id="getCheckItems" resultType="Map">
SELECT
ppi.id inputItemId,
pii.name itemName,
pci.id IS NOT NULL finishStatus,
pci.safety_danger_num safetyNum,
pci.major_danger_num majorNum,
DATE_FORMAT(pci.create_date,'%Y-%m-%d %H:%i:%s') checkTime,
pp.name companyName,
pci.user_name executeName
ppi.id inputItemId,
pii.name itemName,
pci.id IS NOT NULL finishStatus,
pci.safety_danger_num safetyNum,
pci.major_danger_num majorNum,
DATE_FORMAT(pci.create_date,'%Y-%m-%d %H:%i:%s') checkTime,
pp.name companyName,
pci.user_name executeName
FROM
p_input_item pii
LEFT JOIN p_point_inputitem ppi ON pii.id = ppi.input_item_id
LEFT JOIN p_route_point_item prpi ON prpi.point_input_item_id = ppi.id
LEFT JOIN p_route_point prp ON prp.id = prpi.route_point_id AND prp.point_id = ppi.point_id
LEFT JOIN p_check_input pci ON pci.route_point_item_id = prpi.id
LEFT JOIN p_point pp ON ppi.point_id =pp.id
p_input_item pii
LEFT JOIN p_point_inputitem ppi ON pii.id = ppi.input_item_id
LEFT JOIN p_route_point_item prpi ON prpi.point_input_item_id = ppi.id
LEFT JOIN p_route_point prp ON prp.id = prpi.route_point_id AND prp.point_id = ppi.point_id
LEFT JOIN p_check_input pci ON pci.route_point_item_id = prpi.id
LEFT JOIN p_point pp ON ppi.point_id =pp.id
WHERE
prp.route_id = #{routeId}
<if test="pointId != null and pointId != '' and pointId != -1">
AND ppi.point_id = #{pointId}
</if>
<choose>
<when test="status != null and status != '' and status==0">
AND pci.id IS NULL
</when>
<when test="status != null and status != '' and status==1">
AND pci.id IS NOT NULL
</when>
</choose>
<if test="teamId != null and teamId != ''">
AND pp.original_id = #{teamId}
</if>
<!-- <if test="status != null and status != ''">-->
<!-- AND pc.point_id = #{status}-->
<!-- </if>-->
<!-- <if test="companyName != null and companyName != ''">-->
<!-- AND pc.company_name = #{company_name}-->
<!-- </if>-->
prp.route_id = #{routeId}
<if test="pointId != null and pointId != '' and pointId != -1">
AND ppi.point_id = #{pointId}
</if>
<choose>
<when test="status != null and status != '' and status==0">
AND pci.id IS NULL
</when>
<when test="status != null and status != '' and status==1">
AND pci.id IS NOT NULL
</when>
</choose>
<if test="teamId != null and teamId != ''">
AND pp.original_id = #{teamId}
</if>
<!-- <if test="status != null and status != ''">-->
<!-- AND pc.point_id = #{status}-->
<!-- </if>-->
<!-- <if test="companyName != null and companyName != ''">-->
<!-- AND pc.company_name = #{company_name}-->
<!-- </if>-->
limit #{offset},#{pageSize}
</select>
......@@ -1983,12 +1988,12 @@
</select>
<select id="queryPageCount" resultType="long">
SELECT
COUNT(1)
COUNT(1)
FROM
p_check c
LEFT JOIN p_check_input ci ON ci.check_id = c.id
LEFT JOIN p_input_item i ON i.id = ci.input_id
LEFT JOIN p_point pp ON pp.id = c.point_id
p_check c
LEFT JOIN p_check_input ci ON ci.check_id = c.id
LEFT JOIN p_input_item i ON i.id = ci.input_id
LEFT JOIN p_point pp ON pp.id = c.point_id
<where>
<if test="planId != null">
c.plan_id = #{planId}
......@@ -1999,30 +2004,30 @@
<if test="pointId != null and pointId != -1">
AND pp.id = #{pointId}
</if>
<!-- <if test="orgCode != null">-->
<!-- AND c.org_code = #{orgCode}-->
<!-- </if>-->
<!-- <if test="orgCode != null">-->
<!-- AND c.org_code = #{orgCode}-->
<!-- </if>-->
</where>
</select>
<select id="queryPage" resultType="com.yeejoin.amos.supervision.business.vo.CheckVo">
SELECT
i.id,
i.`name` inputItemName,
ci.safety_danger_num,
ci.major_danger_num,
ci.create_date checkTime,
ci.user_name,
ci.accompany_user_name,
pp.original_id,
pp.name companyName,
c.id checkId,
i.id,
i.`name` inputItemName,
ci.safety_danger_num,
ci.major_danger_num,
ci.create_date checkTime,
ci.user_name,
ci.accompany_user_name,
pp.original_id,
pp.name companyName,
IF
( c.check_time IS NULL, 0, 1 ) AS ext
( c.check_time IS NULL, 0, 1 ) AS ext
FROM
p_check c
LEFT JOIN p_check_input ci ON ci.check_id = c.id
LEFT JOIN p_input_item i ON i.id = ci.input_id
LEFT JOIN p_point pp ON pp.id = c.point_id
p_check c
LEFT JOIN p_check_input ci ON ci.check_id = c.id
LEFT JOIN p_input_item i ON i.id = ci.input_id
LEFT JOIN p_point pp ON pp.id = c.point_id
<where>
<if test="planId != null">
c.plan_id = #{planId}
......@@ -2033,9 +2038,9 @@
<if test="pointId != null and pointId != -1">
AND pp.id = #{pointId}
</if>
<!-- <if test="orgCode != null">-->
<!-- AND c.org_code = #{orgCode}-->
<!-- </if>-->
<!-- <if test="orgCode != null">-->
<!-- AND c.org_code = #{orgCode}-->
<!-- </if>-->
ORDER BY c.check_time DESC
<choose>
<when test="pageSize==-1"></when>
......@@ -2043,4 +2048,13 @@
</choose>
</where>
</select>
<select id="getPictureByCheckId" resultType="java.lang.String">
SELECT
photo_data
FROM
p_check_shot
WHERE
check_id = #{checkId}
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment