Commit ada3b161 authored by tangwei's avatar tangwei

点状态,更新

parent a85fe42f
package com.yeejoin.amos.bank.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.yeejoin.amos.bank.service.InspectionService;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import com.yeejoin.amos.op.core.common.response.CommonResponse;
import com.yeejoin.amos.op.core.util.CommonResponseUtil;
import com.yeejoin.amos.spc.business.controller.BaseController;
import com.yeejoin.amos.spc.business.param.ReginParams;
import com.yeejoin.amos.spc.business.remote.RemoteSecurityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
/**
* 巡检controller
* @author DELL
*
*/
@RestController
@RequestMapping(value = "/bank/inspection")
@Api(value = "/bank/inspection", tags = {"巡检API"})
public class InspectionController extends BaseController{
@Autowired
private InspectionService inspectionService;
@Autowired
RemoteSecurityService remoteSecurityService;
@GetMapping(value = "/rightTopChart", produces = "application/json;charset=UTF-8")
@ApiOperation(value = "查询主页右上角图片", notes = "查询主页右上角图片")
public CommonResponse rightTopChartData(@ApiParam(value = "公司id", required = false)String companyId) {
// if(companyId == null || "".equals(companyId)) {
// ReginParams reginParams = getSelectedOrgInfo();
// companyId = getCompanyId(reginParams);
//
// return CommonResponseUtil.failure();
// }
ReginParams reginParams = getSelectedOrgInfo();
companyId = getCompanyId(reginParams);
return CommonResponseUtil.success(inspectionService.queryRightTopChart(companyId));
}
@GetMapping(value = "/bottomTable", produces = "application/json;charset=UTF-8")
@ApiOperation(value = "查询主页右下角table", notes = "查询主页右下角table")
public CommonResponse bottomTableData() {
return CommonResponseUtil.success(inspectionService.queryBottomTableData());
}
@ApiOperation(value = "巡检计划执行情况列表", notes = "巡检计划执行情况列表")
@GetMapping(value = "/patrolPlanList")
public CommonResponse patrolPlanList(@ApiParam(value = "当前条数", required = true) @RequestParam Integer start,
@ApiParam(value = "到条数", required = true) @RequestParam Integer end,
@ApiParam(value = "部门编号") @RequestParam(required = false) String deptId,
@ApiParam(value = "部门编号") @RequestParam(required = false) String deptName) {
try {
return CommonResponseUtil.success(inspectionService.queryRightTopChartlist(start, end, deptId,deptName));
} catch (Exception e) {
return CommonResponseUtil.failure("查询异常");
}
}
@GetMapping(value = "/getporint", produces = "application/json;charset=UTF-8")
@ApiOperation(value = "点的状态", notes = "点的状态")
public CommonResponse getporint(@ApiParam(value = "公司id", required = false)String pointid) {
java.util.HashMap<String, Object> map=inspectionService.getporint(pointid);
List<DictionarieValueModel> listDictionaryByDictCode = remoteSecurityService.listDictionaryByDictCode("BANK_ORG");
String xian="";
String xianyang="";
StringBuffer sb = new StringBuffer();
for (DictionarieValueModel e : listDictionaryByDictCode) {
if("xian".equals(e.getDictDataKey())) {
xian=e.getDictDataValue();
}
if("xianyang".equals(e.getDictDataKey())) {
xianyang=e.getDictDataValue();
}
}
java.util.HashMap<String, Object> map1 =new java.util.HashMap<>();
if(map!=null){
int status= Integer.valueOf(map.get("status").toString());
String code= map.get("code").toString();
if(status==2){
map1.put("pointtype", true);
}else{
map1.put("pointtype",false );
}
if (code.indexOf(xian)!=-1){
map1.put("cstype","xian" );
}
if (code.indexOf(xianyang)!=-1){
map1.put("cstype","xianyang" );
}
}
return CommonResponseUtil.success(map1);
}
}
package com.yeejoin.amos.bank.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.yeejoin.amos.bank.service.InspectionService;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import com.yeejoin.amos.op.core.common.response.CommonResponse;
import com.yeejoin.amos.op.core.util.CommonResponseUtil;
import com.yeejoin.amos.spc.business.controller.BaseController;
import com.yeejoin.amos.spc.business.param.ReginParams;
import com.yeejoin.amos.spc.business.remote.RemoteSecurityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
/**
* 巡检controller
* @author DELL
*
*/
@RestController
@RequestMapping(value = "/bank/inspection")
@Api(value = "/bank/inspection", tags = {"巡检API"})
public class InspectionController extends BaseController{
@Autowired
private InspectionService inspectionService;
@Autowired
RemoteSecurityService remoteSecurityService;
@GetMapping(value = "/rightTopChart", produces = "application/json;charset=UTF-8")
@ApiOperation(value = "查询主页右上角图片", notes = "查询主页右上角图片")
public CommonResponse rightTopChartData(@ApiParam(value = "公司id", required = false)String companyId) {
// if(companyId == null || "".equals(companyId)) {
// ReginParams reginParams = getSelectedOrgInfo();
// companyId = getCompanyId(reginParams);
//
// return CommonResponseUtil.failure();
// }
ReginParams reginParams = getSelectedOrgInfo();
companyId = getCompanyId(reginParams);
return CommonResponseUtil.success(inspectionService.queryRightTopChart(companyId));
}
@GetMapping(value = "/bottomTable", produces = "application/json;charset=UTF-8")
@ApiOperation(value = "查询主页右下角table", notes = "查询主页右下角table")
public CommonResponse bottomTableData() {
return CommonResponseUtil.success(inspectionService.queryBottomTableData());
}
@ApiOperation(value = "巡检计划执行情况列表", notes = "巡检计划执行情况列表")
@GetMapping(value = "/patrolPlanList")
public CommonResponse patrolPlanList(@ApiParam(value = "当前条数", required = true) @RequestParam Integer start,
@ApiParam(value = "到条数", required = true) @RequestParam Integer end,
@ApiParam(value = "部门编号") @RequestParam(required = false) String deptId,
@ApiParam(value = "部门编号") @RequestParam(required = false) String deptName) {
try {
return CommonResponseUtil.success(inspectionService.queryRightTopChartlist(start, end, deptId,deptName));
} catch (Exception e) {
return CommonResponseUtil.failure("查询异常");
}
}
@GetMapping(value = "/getporint", produces = "application/json;charset=UTF-8")
@ApiOperation(value = "点的状态", notes = "点的状态")
public CommonResponse getporint(@ApiParam(value = "公司id", required = false)String pointid) {
java.util.HashMap<String, Object> map=inspectionService.getporint(pointid);
List<DictionarieValueModel> listDictionaryByDictCode = remoteSecurityService.listDictionaryByDictCode("BANK_ORG");
String xian="";
String xianyang="";
StringBuffer sb = new StringBuffer();
for (DictionarieValueModel e : listDictionaryByDictCode) {
if("xian".equals(e.getDictDataKey())) {
xian=e.getDictDataValue();
}
if("xianyang".equals(e.getDictDataKey())) {
xianyang=e.getDictDataValue();
}
}
java.util.HashMap<String, Object> map1 =new java.util.HashMap<>();
if(map!=null){
int status= Integer.valueOf(map.get("status").toString());
String code= map.get("code").toString();
if(status==1){
map1.put("pointtype", true);
}else{
map1.put("pointtype",false );
}
if (code.indexOf(xian)!=-1){
map1.put("cstype","xian" );
}
if (code.indexOf(xianyang)!=-1){
map1.put("cstype","xianyang" );
}
}
return CommonResponseUtil.success(map1);
}
}
<?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.yeejoin.amos.spc.business.dao.mapper.StatisticsMapper">
<select id="queryForRiseUp" resultType="java.util.Map">
select
d.countOfType0,
d.countOfSource,
CONCAT(ROUND(IFNULL(d.countOfType0/d.countOfSource,0)*100,2),'%') as type0Rate
from
(
select
count(distinct cl.risk_factors_id) as countOfType0,
(select count(1) from spc_risk_factors rs) as countOfSource
from
spc_risk_factors_level_log as cl
where
cl.type = 1
and
cl.create_date between '${startTime}' and '${endTime}'
) as d
</select>
<select id="riskSourceBroupByDepartment" resultType="java.util.Map">
select
count(b.code = '1' or null) as '1级',
count(b.code = '2' or null) as '2级',
count(b.code = '3' or null) as '3级',
count(b.code = '4' or null) as '4级',
a.belong_department_id as belongDepartmentId,
b.level,
b.code
from
spc_risk_source as a
left join
spc_risk_level as b on a.risk_level = b.id
where
a.risk_type = '04'
and
a.belong_department_id is not null
and
a.belong_department_id != ""
group by a.belong_department_id
</select>
<select id="latentDangerBroupByDepartment" resultType="java.util.Map">
select
count(c.danger_level = 1 or null) as '一般隐患',
count(c.danger_level = 2 or null) as '重大隐患',
a.belong_department_id as belongDepartmentId
from
spc_risk_source as a
left join
p_point as b on b.original_id = a.id
left join
(
select
a.*,b.point_id
from
p_latent_danger as a
inner join
p_latent_danger_patrol as b on a.id = b.latent_danger_id
where
a.danger_type in (2,3)
and a.danger_state in (2,3,4)
) as c on c.point_id = b.id
where
a.belong_department_id is not null
and
a.belong_department_id != ""
and
a.risk_type = '04'
group by a.belong_department_id
</select>
<select id="latentDangerRateGroupByDepartment" resultType="java.util.Map">
select
count(c.id) as dangerCount,
a.belong_department_id as belongDepartmentId
from
spc_risk_source as a
left join
p_point as b on b.original_id = a.id
left join
(
select
a.*,b.point_id
from
p_latent_danger as a
inner join
p_latent_danger_patrol as b on a.id = b.latent_danger_id
where
a.danger_type in (2,3)
and a.danger_state in (2,3,4)
and a.overtime_state = 1
) as c on c.point_id = b.id
where
a.belong_department_id is not null
and
a.belong_department_id != ""
and
a.risk_type = '04'
group by a.belong_department_id
</select>
<select id="listPatrolPlan" resultType="java.util.Map">
select
a.id as planTaskId,
a.user_id as userId,
b.name as planName,
b.dept_id as deptId,
(select count(1) from p_plan_task_detail where task_no = a.id and status = 0) as noStartNum,
(select count(1) from p_plan_task_detail where task_no = a.id and status = 1) as passNum,
(select count(1) from p_plan_task_detail where task_no = a.id and status = 2) as noPassNum,
(select count(1) from p_plan_task_detail where task_no = a.id and status = 3) as overTimeNum
from
p_plan_task as a
left join
p_plan as b on a.plan_id = b.id
<where>
<if test="true">
and a.begin_time &lt;= now()
</if>
<if test="true">
and a.end_time &gt;= now()
</if>
<if test="deptId != null and deptId != ''">
and find_in_set(#{deptId},b.dept_id)
</if>
</where>
group by b.id
<if test="offset != null and limit != null">
limit #{offset},#{limit}
</if>
</select>
<select id="countPatrolPlan" resultType="java.lang.Long">
select count(1) from (
select
a.id
from
p_plan_task as a
left join
p_plan as b on a.plan_id = b.id
<where>
<if test="true">
and a.begin_time &lt;= now()
</if>
<if test="true">
and a.end_time &gt;= now()
</if>
<if test="deptId != null and deptId != ''">
and find_in_set(#{deptId},b.dept_id)
</if>
</where>
group by b.id
) tmp
</select>
<select id="listByTaskNo" resultType="java.util.Map">
select
a.task_no as planTaskId,
a.point_id as pointId,
a.status as status,
b.name as pointName
from
p_plan_task_detail as a
left join
p_point as b on a.point_id = b.id
where
task_no in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="queryRightTopChartDataByDepId" resultType="java.util.HashMap">
<!-- select sum(tmp2.passNum) as passNum,sum(tmp2.nopassNum) as nopassNum,sum(tmp2.overTime) as overTime,dept_id as deptId
from
(select
if(tmp.status=1,1,0) as passNum,
if(tmp.status=2,1,0) as nopassNum,
if(tmp.status=3,1,0) as overTime,
tmp.dept_id
from (
select D.point_id,D.status,P.dept_id
from p_plan_task_detail D
left join p_plan_task T on D.task_no = T.id
left join p_plan P on P.id = T.plan_id
where D.id in (select max(id) from p_plan_task_detail group by point_id)
AND T.end_time &lt; NOW()
AND P.dept_id IS NOT NULL) tmp
where tmp.dept_id IN
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
) tmp2 group by tmp2.dept_id -->
<!-- select
sum(tmp2.passNum) as passNum,sum(tmp2.nopassNum) as nopassNum,sum(tmp2.overTime) as overTime,dept_id as deptId,tmp2.name,tmp2.beginTime,tmp2.endTime
from
(select
if(tmp.status=1,1,0) as passNum,
if(tmp.status=2,1,0) as nopassNum,
if(IFNULL(tmp.status,3)=3,1,0) as overTime,
tmp.dept_id,
tmp.name,
tmp.begin_time as beginTime,
tmp.end_time as endTime
from (
select pl.id,D.point_id,D.status,R.dept_id,R.name,pl.begin_time,pl.end_time
from P_plan_task pl
left join p_plan_task_detail D ON D.task_no = pl.id
left join p_route_point p on D.point_id = P.point_id
left join p_route R on R.id = P.route_id
left join P_plan_task T on T.id = D.task_no
left join p_plan N on N.id = pl.plan_id
where pl.Finish_Status in(2,3) AND R.dept_id = #{deptId}
AND N.status = 1
AND pl.end_time = CURRENT_DATE
order by pl.id DESC limit 1
) tmp
) tmp2 group by name,tmp2.beginTime,tmp2.endTime -->
select
<!-- SUBSTRING_INDEX(org_code, "-", -1)deptId,
--> MAX(CASE a.finish_status WHEN 0 THEN a.NUM ELSE 0 END ) noStartNum,
MAX(CASE a.finish_status WHEN 1 THEN a.NUM ELSE 0 END ) noPassNum,
MAX(CASE a.finish_status WHEN 2 THEN a.NUM ELSE 0 END ) passNum,
MAX(CASE a.finish_status WHEN 3 THEN a.NUM ELSE 0 END ) overTimeNum
from ( select
COUNT(*) NUM,
l.finish_status,
l.org_code
from p_plan_task as l where DATE_FORMAT(l.begin_time,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')
and l.org_code like CONCAT(#{deptId},"%") GROUP BY l.finish_status) a
</select>
<resultMap id="planTaskReturn" type="com.yeejoin.amos.bank.entity.planTaskReturn">
<id column="planTaskId" property="planTaskId"/>
<result column="userId" property="userId"/>
<result column="planName" property="planName"/>
<result column="deptId" property="deptId"/>
<result column="noStartNum" property="noStartNum"/>
<result column="passNum" property="passNum"/>
<result column="noPassNum" property="noPassNum"/>
<result column="overTimeNum" property="overTimeNum"/>
<result column="beginTime" property="beginTime"/>
<result column="endTime" property="endTime"/>
</resultMap>
<resultMap id="pointReturn" type="com.yeejoin.amos.bank.entity.pointReturn">
<id property="taskNo" column="taskNo"></id>
<result property="isFinish" column="isFinish"/>
<result property="name" column="name"/>
<result property="id" column="id"/>
<result property="coordinates" column="coordinates"/>
<result property="floor" column="floor"/>
</resultMap>
<select id="planTaskReturnliat" resultMap="planTaskReturn">
select
a.id as planTaskId,
a.user_id as userId,
CONCAT(a.id,"-",b.name) as planName,
b.dept_id as deptId,
a.begin_time beginTime,
a.end_time endTime,
(select count(1) from p_plan_task_detail where task_no = a.id and status = 0) as noStartNum,
(select count(1) from p_plan_task_detail where task_no = a.id and status = 1) as passNum,
(select count(1) from p_plan_task_detail where task_no = a.id and status = 2) as noPassNum,
(select count(1) from p_plan_task_detail where task_no = a.id and status = 3) as overTimeNum
from
(select l.* from p_plan_task as l where DATE_FORMAT(l.begin_time,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d') and l.org_code like CONCAT(#{deptId},"%"))as a
left join
p_plan as b on a.plan_id = b.id
group by a.id
<if test="offset != null and limit != null">
limit #{offset},#{limit}
</if>
</select>
<select id="pointReturnlist" resultMap="pointReturn">
select
p_plan_task_detail.status isFinish ,
p_point.`name`,
p_point.id,
p_point.floor,
p_point.coordinates,
p_plan_task_detail.task_no taskNo
from p_plan_task_detail LEFT JOIN p_point on p_plan_task_detail.point_id =p_point.id
where p_plan_task_detail.task_no=#{planTaskId} ORDER BY p_plan_task_detail.id
</select>
<select id="getporint" resultType="java.util.Map">
SELECT
p_point.org_code code,
p_point.status
from p_point where p_point.id=#{pointid}
</select>
<?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.yeejoin.amos.spc.business.dao.mapper.StatisticsMapper">
<select id="queryForRiseUp" resultType="java.util.Map">
select
d.countOfType0,
d.countOfSource,
CONCAT(ROUND(IFNULL(d.countOfType0/d.countOfSource,0)*100,2),'%') as type0Rate
from
(
select
count(distinct cl.risk_factors_id) as countOfType0,
(select count(1) from spc_risk_factors rs) as countOfSource
from
spc_risk_factors_level_log as cl
where
cl.type = 1
and
cl.create_date between '${startTime}' and '${endTime}'
) as d
</select>
<select id="riskSourceBroupByDepartment" resultType="java.util.Map">
select
count(b.code = '1' or null) as '1级',
count(b.code = '2' or null) as '2级',
count(b.code = '3' or null) as '3级',
count(b.code = '4' or null) as '4级',
a.belong_department_id as belongDepartmentId,
b.level,
b.code
from
spc_risk_source as a
left join
spc_risk_level as b on a.risk_level = b.id
where
a.risk_type = '04'
and
a.belong_department_id is not null
and
a.belong_department_id != ""
group by a.belong_department_id
</select>
<select id="latentDangerBroupByDepartment" resultType="java.util.Map">
select
count(c.danger_level = 1 or null) as '一般隐患',
count(c.danger_level = 2 or null) as '重大隐患',
a.belong_department_id as belongDepartmentId
from
spc_risk_source as a
left join
p_point as b on b.original_id = a.id
left join
(
select
a.*,b.point_id
from
p_latent_danger as a
inner join
p_latent_danger_patrol as b on a.id = b.latent_danger_id
where
a.danger_type in (2,3)
and a.danger_state in (2,3,4)
) as c on c.point_id = b.id
where
a.belong_department_id is not null
and
a.belong_department_id != ""
and
a.risk_type = '04'
group by a.belong_department_id
</select>
<select id="latentDangerRateGroupByDepartment" resultType="java.util.Map">
select
count(c.id) as dangerCount,
a.belong_department_id as belongDepartmentId
from
spc_risk_source as a
left join
p_point as b on b.original_id = a.id
left join
(
select
a.*,b.point_id
from
p_latent_danger as a
inner join
p_latent_danger_patrol as b on a.id = b.latent_danger_id
where
a.danger_type in (2,3)
and a.danger_state in (2,3,4)
and a.overtime_state = 1
) as c on c.point_id = b.id
where
a.belong_department_id is not null
and
a.belong_department_id != ""
and
a.risk_type = '04'
group by a.belong_department_id
</select>
<select id="listPatrolPlan" resultType="java.util.Map">
select
a.id as planTaskId,
a.user_id as userId,
b.name as planName,
b.dept_id as deptId,
(select count(1) from p_plan_task_detail where task_no = a.id and status = 0) as noStartNum,
(select count(1) from p_plan_task_detail where task_no = a.id and status = 1) as passNum,
(select count(1) from p_plan_task_detail where task_no = a.id and status = 2) as noPassNum,
(select count(1) from p_plan_task_detail where task_no = a.id and status = 3) as overTimeNum
from
p_plan_task as a
left join
p_plan as b on a.plan_id = b.id
<where>
<if test="true">
and a.begin_time &lt;= now()
</if>
<if test="true">
and a.end_time &gt;= now()
</if>
<if test="deptId != null and deptId != ''">
and find_in_set(#{deptId},b.dept_id)
</if>
</where>
group by b.id
<if test="offset != null and limit != null">
limit #{offset},#{limit}
</if>
</select>
<select id="countPatrolPlan" resultType="java.lang.Long">
select count(1) from (
select
a.id
from
p_plan_task as a
left join
p_plan as b on a.plan_id = b.id
<where>
<if test="true">
and a.begin_time &lt;= now()
</if>
<if test="true">
and a.end_time &gt;= now()
</if>
<if test="deptId != null and deptId != ''">
and find_in_set(#{deptId},b.dept_id)
</if>
</where>
group by b.id
) tmp
</select>
<select id="listByTaskNo" resultType="java.util.Map">
select
a.task_no as planTaskId,
a.point_id as pointId,
a.status as status,
b.name as pointName
from
p_plan_task_detail as a
left join
p_point as b on a.point_id = b.id
where
task_no in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="queryRightTopChartDataByDepId" resultType="java.util.HashMap">
<!-- select sum(tmp2.passNum) as passNum,sum(tmp2.nopassNum) as nopassNum,sum(tmp2.overTime) as overTime,dept_id as deptId
from
(select
if(tmp.status=1,1,0) as passNum,
if(tmp.status=2,1,0) as nopassNum,
if(tmp.status=3,1,0) as overTime,
tmp.dept_id
from (
select D.point_id,D.status,P.dept_id
from p_plan_task_detail D
left join p_plan_task T on D.task_no = T.id
left join p_plan P on P.id = T.plan_id
where D.id in (select max(id) from p_plan_task_detail group by point_id)
AND T.end_time &lt; NOW()
AND P.dept_id IS NOT NULL) tmp
where tmp.dept_id IN
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
) tmp2 group by tmp2.dept_id -->
<!-- select
sum(tmp2.passNum) as passNum,sum(tmp2.nopassNum) as nopassNum,sum(tmp2.overTime) as overTime,dept_id as deptId,tmp2.name,tmp2.beginTime,tmp2.endTime
from
(select
if(tmp.status=1,1,0) as passNum,
if(tmp.status=2,1,0) as nopassNum,
if(IFNULL(tmp.status,3)=3,1,0) as overTime,
tmp.dept_id,
tmp.name,
tmp.begin_time as beginTime,
tmp.end_time as endTime
from (
select pl.id,D.point_id,D.status,R.dept_id,R.name,pl.begin_time,pl.end_time
from P_plan_task pl
left join p_plan_task_detail D ON D.task_no = pl.id
left join p_route_point p on D.point_id = P.point_id
left join p_route R on R.id = P.route_id
left join P_plan_task T on T.id = D.task_no
left join p_plan N on N.id = pl.plan_id
where pl.Finish_Status in(2,3) AND R.dept_id = #{deptId}
AND N.status = 1
AND pl.end_time = CURRENT_DATE
order by pl.id DESC limit 1
) tmp
) tmp2 group by name,tmp2.beginTime,tmp2.endTime -->
select
<!-- SUBSTRING_INDEX(org_code, "-", -1)deptId,
--> MAX(CASE a.finish_status WHEN 0 THEN a.NUM ELSE 0 END ) noStartNum,
MAX(CASE a.finish_status WHEN 1 THEN a.NUM ELSE 0 END ) noPassNum,
MAX(CASE a.finish_status WHEN 2 THEN a.NUM ELSE 0 END ) passNum,
MAX(CASE a.finish_status WHEN 3 THEN a.NUM ELSE 0 END ) overTimeNum
from ( select
COUNT(*) NUM,
l.finish_status,
l.org_code
from p_plan_task as l where DATE_FORMAT(l.begin_time,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')
and l.org_code like CONCAT(#{deptId},"%") GROUP BY l.finish_status) a
</select>
<resultMap id="planTaskReturn" type="com.yeejoin.amos.bank.entity.planTaskReturn">
<id column="planTaskId" property="planTaskId"/>
<result column="userId" property="userId"/>
<result column="planName" property="planName"/>
<result column="deptId" property="deptId"/>
<result column="noStartNum" property="noStartNum"/>
<result column="passNum" property="passNum"/>
<result column="noPassNum" property="noPassNum"/>
<result column="overTimeNum" property="overTimeNum"/>
<result column="beginTime" property="beginTime"/>
<result column="endTime" property="endTime"/>
</resultMap>
<resultMap id="pointReturn" type="com.yeejoin.amos.bank.entity.pointReturn">
<id property="taskNo" column="taskNo"></id>
<result property="isFinish" column="isFinish"/>
<result property="name" column="name"/>
<result property="id" column="id"/>
<result property="coordinates" column="coordinates"/>
<result property="floor" column="floor"/>
</resultMap>
<select id="planTaskReturnliat" resultMap="planTaskReturn">
select
a.id as planTaskId,
a.user_id as userId,
CONCAT(a.id,"-",b.name) as planName,
b.dept_id as deptId,
a.begin_time beginTime,
a.end_time endTime,
(select count(1) from p_plan_task_detail where task_no = a.id and status = 0) as noStartNum,
(select count(1) from p_plan_task_detail where task_no = a.id and status = 1) as passNum,
(select count(1) from p_plan_task_detail where task_no = a.id and status = 2) as noPassNum,
(select count(1) from p_plan_task_detail where task_no = a.id and status = 3) as overTimeNum
from
(select l.* from p_plan_task as l where DATE_FORMAT(l.begin_time,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d') and l.org_code like CONCAT(#{deptId},"%"))as a
left join
p_plan as b on a.plan_id = b.id
group by a.id
<if test="offset != null and limit != null">
limit #{offset},#{limit}
</if>
</select>
<select id="pointReturnlist" resultMap="pointReturn">
select
p_plan_task_detail.status isFinish ,
p_point.`name`,
p_point.id,
p_point.floor,
p_point.coordinates,
p_plan_task_detail.task_no taskNo
from p_plan_task_detail LEFT JOIN p_point on p_plan_task_detail.point_id =p_point.id
where p_plan_task_detail.task_no=#{planTaskId} ORDER BY p_plan_task_detail.id
</select>
<select id="getporint" resultType="java.util.Map">
SELECT
p_alarm_point.`code` code ,
p_alarm_point.is_alarm status
from p_alarm_point where p_alarm_point.point_type=3 and p_alarm_point.is_alarm=1 and p_alarm_point.point_id=#{pointid}
</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