Commit 72dc0356 authored by tangwei's avatar tangwei

巡检统计接口编写

parent 0feb06f1
......@@ -22,6 +22,7 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -44,70 +45,81 @@ public class InspectionStatisticsController extends AbstractBaseController {
@ApiOperation(value = "巡查点统计饼状图,已巡检未巡检", notes = "巡查点统计饼状图,已巡检未巡检")
@GetMapping(value = "/point/statistics/xj")
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth=false)
public CommonResponse detailxj(
@ApiParam(value = "线路关键字", required = false) @RequestParam String name,
public HashMap<String, Object> detailxj(
@ApiParam(value = "线路关键字", required = false) @RequestParam(required = false) String name,
@ApiParam(value = "统计分类", required = true) @RequestParam String type) {
String timeType="";
switch (type) {
case "日":
timeType="d";
name= ( name!=null&&!"".equals(name)? "-日-"+name:null);
timeType="dt";
name= ( name!=null&&!"".equals(name)? "-日-"+name:"-日-");
break;
case "月":
timeType="m";
name= ( name!=null&&!"".equals(name)? "-月-"+name:null);
timeType="mt";
name= ( name!=null&&!"".equals(name)? "-月-"+name:"-月-");
break;
case "季":
timeType="j";
name= ( name!=null&&!"".equals(name)? "-季-"+name:null);
timeType="jt";
name= ( name!=null&&!"".equals(name)? "-季-"+name:"-季-");
break;
case "年":
timeType="yr";
name= ( name!=null&&!"".equals(name)? "-年-"+name:null);
timeType="yrt";
name= ( name!=null&&!"".equals(name)? "-年-"+name:"-年-");
break;
default:
throw new BadRequest("类型错误.");
}
List<Map<String, Object>> data= taskServiceImpl.getStatisticsByTypeXJ( name, timeType);
return CommonResponseUtil.success(data);
HashMap<String, Object> temph = new HashMap<>();
temph.put("result",data);
temph.put("status",200);
temph.put("message","");
return temph;
}
@ApiOperation(value = "巡查点统计饼状图,合格不合格", notes = "巡查点统计饼状图,合格不合格")
@GetMapping(value = "/point/statistics/hg")
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth=false)
public CommonResponse detailhg(
@ApiParam(value = "线路关键字", required = false) @RequestParam String name,
public HashMap<String, Object> detailhg(
@ApiParam(value = "线路关键字", required = false) @RequestParam (required = false) String name,
@ApiParam(value = "统计分类", required = true) @RequestParam String type) {
String timeType="";
switch (type) {
case "日":
timeType="d";
name= ( name!=null&&!"".equals(name)? "-日-"+name:null);
timeType="dt";
name= ( name!=null&&!"".equals(name)? "-日-"+name:"-日-");
break;
case "月":
timeType="m";
name= ( name!=null&&!"".equals(name)? "-月-"+name:null);
timeType="mt";
name= ( name!=null&&!"".equals(name)? "-月-"+name:"-月-");
break;
case "季":
timeType="j";
name= ( name!=null&&!"".equals(name)? "-季-"+name:null);
timeType="jt";
name= ( name!=null&&!"".equals(name)? "-季-"+name:"-季-");
break;
case "年":
timeType="yr";
name= ( name!=null&&!"".equals(name)? "-年-"+name:null);
timeType="yrt";
name= ( name!=null&&!"".equals(name)? "-年-"+name:"-年-");
break;
default:
throw new BadRequest("类型错误.");
}
List<Map<String, Object>> data= taskServiceImpl.getStatisticsByTypeHG( name, timeType);
return CommonResponseUtil.success(data);
HashMap<String, Object> temph = new HashMap<>();
temph.put("result",data);
temph.put("status",200);
temph.put("message","");
return temph;
}
@ApiOperation(value = "日巡检线路区域", notes = "日巡检线路区域")
@GetMapping(value = "/point/statistics/qy")
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth=false)
public CommonResponse detailqy(
@ApiParam(value = "统计分类", required = true) @RequestParam String type) {
public HashMap<String, Object> detailqy(
@ApiParam(value = "统计分类", required = true) @RequestParam String type,
@ApiParam(value = "线路关键字", required = true) @RequestParam int pageNumber,
@ApiParam(value = "统计分类", required = true) @RequestParam int pageSize) {
String name="";
switch (type) {
case "日":
......@@ -125,8 +137,8 @@ public class InspectionStatisticsController extends AbstractBaseController {
default:
throw new BadRequest("类型错误.");
}
List<Map<String, Object>> data= taskServiceImpl.getLinetype( name);
return CommonResponseUtil.success(data);
HashMap<String, Object> data= taskServiceImpl.getLinetype(pageNumber-1,pageSize, name);
return data;
}
......@@ -134,68 +146,68 @@ public class InspectionStatisticsController extends AbstractBaseController {
@ApiOperation(value = "巡检不合格", notes = "巡检不合格")
@GetMapping(value = "/point/statistics/xjbhg")
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth=false)
public CommonResponse detailxjbhg(
@ApiParam(value = "线路关键字", required = false) @RequestParam String name,
public HashMap<String, Object> detailxjbhg(
@ApiParam(value = "线路关键字", required = false) @RequestParam(required = false) String name,
@ApiParam(value = "统计分类", required = true) @RequestParam String type,
@ApiParam(value = "线路关键字", required = true) @RequestParam int pageNumber,
@ApiParam(value = "统计分类", required = true) @RequestParam int pageSize) {
String timeType="";
switch (type) {
case "日":
timeType="d";
name= ( name!=null&&!"".equals(name)? "-日-"+name:null);
timeType="dt";
name= ( name!=null&&!"".equals(name)? "-日-"+name:"-日-");
break;
case "月":
timeType="m";
name= ( name!=null&&!"".equals(name)? "-月-"+name:null);
timeType="mt";
name= ( name!=null&&!"".equals(name)? "-月-"+name:"-月-");
break;
case "季":
timeType="j";
name= ( name!=null&&!"".equals(name)? "-季-"+name:null);
timeType="jt";
name= ( name!=null&&!"".equals(name)? "-季-"+name:"-季-");
break;
case "年":
timeType="yr";
name= ( name!=null&&!"".equals(name)? "-年-"+name:null);
timeType="yrt";
name= ( name!=null&&!"".equals(name)? "-年-"+name:"-年-");
break;
default:
throw new BadRequest("类型错误.");
}
Page<Map<String, Object>> data= taskServiceImpl.getLinetypeUnqualified( pageNumber, pageSize, name, timeType);
return CommonResponseUtil.success(data);
HashMap<String, Object> data= taskServiceImpl.getLinetypeUnqualified( pageNumber-1, pageSize, name, timeType);
return data;
}
@ApiOperation(value = "未巡检", notes = "未巡检")
@GetMapping(value = "/point/statistics/wxj")
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth=false)
public CommonResponse detailwxj(
@ApiParam(value = "线路关键字", required = false) @RequestParam String name,
public HashMap<String, Object> detailwxj(
@ApiParam(value = "线路关键字", required = false) @RequestParam(required = false) String name,
@ApiParam(value = "统计分类", required = true) @RequestParam String type,
@ApiParam(value = "线路关键字", required = true) @RequestParam int pageNumber,
@ApiParam(value = "统计分类", required = true) @RequestParam int pageSize) {
String timeType="";
switch (type) {
case "日":
timeType="d";
name= ( name!=null&&!"".equals(name)? "-日-"+name:null);
timeType="dt";
name= ( name!=null&&!"".equals(name)? "-日-"+name:"-日-");
break;
case "月":
timeType="m";
name= ( name!=null&&!"".equals(name)? "-月-"+name:null);
timeType="mt";
name= ( name!=null&&!"".equals(name)? "-月-"+name:"-月-");
break;
case "季":
timeType="j";
name= ( name!=null&&!"".equals(name)? "-季-"+name:null);
timeType="jt";
name= ( name!=null&&!"".equals(name)? "-季-"+name:"-季-");
break;
case "年":
timeType="yr";
name= ( name!=null&&!"".equals(name)? "-年-"+name:null);
timeType="yrt";
name= ( name!=null&&!"".equals(name)? "-年-"+name:"-年-");
break;
default:
throw new BadRequest("类型错误.");
}
Page<Map<String, Object>> data= taskServiceImpl.getLinetypeNotInspected( pageNumber, pageSize, name, timeType);
return CommonResponseUtil.success(data);
HashMap<String, Object> data= taskServiceImpl.getLinetypeNotInspected( pageNumber-1, pageSize, name, timeType);
return data;
}
......
......@@ -211,7 +211,9 @@ public interface PlanTaskMapper extends BaseMapper {
Map<String,Object> getStatisticsByTypeHG(@Param("name") String name,@Param("timeType") String timeType);
//根据日线路(今日),月线路(当月)。季度线路(本季度),年线路(本年) 获取线路关键区域
List<Map<String,Object>> getLinetype(@Param("nameType") String nameType);
List<Map<String,Object>> getLinetype(@Param("offset") Long offset,@Param("pageSize") int pageSize,@Param("name") String name);
//根据日线路(今日),月线路(当月)。季度线路(本季度),年线路(本年) 获取线路关键区域
long getLinetypecount(@Param("name") String name);
//根据线路关键字过滤,日线路(今日),月线路(当月)。季度线路(本季度),年线路(本年) 不合格
List<Map<String,Object>> getLinetypeUnqualified(@Param("offset") Long offset,@Param("pageSize") int pageSize,@Param("name") String name,@Param("timeType") String timeType);
......
......@@ -635,26 +635,176 @@ public class TaskServiceImpl implements ITaskService {
}
@Override
public List<Map<String, Object>> getLinetype(String nameType) {
return planTaskMapper.getLinetype(nameType);
public HashMap<String, Object> getLinetype(int pageNumber,int pageSize,String nameType) {
CommonPageable commonPageable=new CommonPageable(pageNumber, pageSize);
List<Map<String, Object>> data= planTaskMapper.getLinetype(commonPageable.getOffset(),commonPageable.getPageSize(),nameType);
Long total= planTaskMapper.getLinetypecount(nameType);
Page<Map<String, Object>> result = new PageImpl<Map<String, Object>>(data, commonPageable, total);
List< HashMap<String, Object>> colModel=new ArrayList<>();
HashMap<String, Object> temph1 = new HashMap<>();
temph1.put("fid","name");
temph1.put("dataIndex","name");
temph1.put("name"," 巡检区域");
temph1.put("title","巡检区域");
temph1.put("type","dataGrid");
temph1.put("key","name");
colModel.add(temph1);
HashMap<String, Object> dataGridMock = new HashMap<>();
dataGridMock.put("current",result.getNumber()+1);
dataGridMock.put("total",result.getTotalElements());
dataGridMock.put("pagination",false);
dataGridMock.put("totalPage",result.getTotalPages());
dataGridMock.put("dataList",result.getContent());
dataGridMock.put("pageSize",result.getSize());
HashMap<String, Object> DATE = new HashMap<>();
DATE.put("dataGridMock",dataGridMock);
DATE.put("colModel",colModel);
HashMap<String, Object> temph = new HashMap<>();
temph.put("result",DATE);
temph.put("status",200);
temph.put("message","");
return temph;
}
@Override
public Page<Map<String, Object>> getLinetypeUnqualified(int pageNumber,int pageSize,String nameType, String timeType) {
public HashMap<String, Object> getLinetypeUnqualified(int pageNumber,int pageSize,String nameType, String timeType) {
CommonPageable commonPageable=new CommonPageable(pageNumber, pageSize);
Long total= planTaskMapper.countLinetypeUnqualified(nameType,timeType);
List<Map<String,Object>> content=planTaskMapper.getLinetypeUnqualified(commonPageable.getOffset(), pageSize, nameType, timeType);
Page<Map<String, Object>> result = new PageImpl<Map<String, Object>>(content, commonPageable, total);
return result;
List< HashMap<String, Object>> colModel=new ArrayList<>();
HashMap<String, Object> temph1 = new HashMap<>();
temph1.put("fid","pointNum");
temph1.put("dataIndex","pointNum");
temph1.put("name"," 巡检点编号");
temph1.put("title","巡检点编号");
temph1.put("type","dataGrid");
temph1.put("key","pointNum");
colModel.add(temph1);
HashMap<String, Object> temph2 = new HashMap<>();
temph2.put("fid","name");
temph2.put("dataIndex","name");
temph2.put("name"," 巡检点名称");
temph2.put("title","巡检点名称");
temph2.put("type","dataGrid");
temph2.put("key","name");
colModel.add(temph2);
HashMap<String, Object> temph3 = new HashMap<>();
temph3.put("fid","bizOrgName");
temph3.put("dataIndex","bizOrgName");
temph3.put("name"," 所属部门");
temph3.put("title","所属部门");
temph3.put("type","dataGrid");
temph3.put("key","bizOrgName");
colModel.add(temph3);
HashMap<String, Object> temph4 = new HashMap<>();
temph4.put("fid","actor");
temph4.put("dataIndex","actor");
temph4.put("name"," 执行人");
temph4.put("title","执行人");
temph4.put("type","dataGrid");
temph4.put("key","actor");
colModel.add(temph4);
HashMap<String, Object> temph5 = new HashMap<>();
temph5.put("fid","create_date");
temph5.put("dataIndex","create_date");
temph5.put("name"," 时间");
temph5.put("title","时间");
temph5.put("type","dataGrid");
temph5.put("key","create_date");
colModel.add(temph5);
HashMap<String, Object> dataGridMock = new HashMap<>();
dataGridMock.put("current",result.getNumber()+1);
dataGridMock.put("total",result.getTotalElements());
dataGridMock.put("pagination",false);
dataGridMock.put("totalPage",result.getTotalPages());
dataGridMock.put("dataList",result.getContent());
dataGridMock.put("pageSize",result.getSize());
HashMap<String, Object> DATE = new HashMap<>();
DATE.put("dataGridMock",dataGridMock);
DATE.put("colModel",colModel);
HashMap<String, Object> temph = new HashMap<>();
temph.put("result",DATE);
temph.put("status",200);
temph.put("message","");
return temph;
}
@Override
public Page<Map<String, Object>> getLinetypeNotInspected(int pageNumber,int pageSize,String nameType, String timeType) {
public HashMap<String, Object> getLinetypeNotInspected(int pageNumber,int pageSize,String nameType, String timeType) {
CommonPageable commonPageable=new CommonPageable(pageNumber, pageSize);
Long total= planTaskMapper.countLinetypeNotInspected(nameType,timeType);
List<Map<String,Object>> content=planTaskMapper.getLinetypeNotInspected(commonPageable.getOffset(), pageSize, nameType, timeType);
Page<Map<String, Object>> result = new PageImpl<Map<String, Object>>(content, commonPageable, total);
return result;
List< HashMap<String, Object>> colModel=new ArrayList<>();
HashMap<String, Object> temph2 = new HashMap<>();
temph2.put("fid","routeName");
temph2.put("dataIndex","routeName");
temph2.put("name"," 路线名称");
temph2.put("title","路线名称");
temph2.put("type","dataGrid");
temph2.put("key","routeName");
colModel.add(temph2);
HashMap<String, Object> temph1 = new HashMap<>();
temph1.put("fid","pointNum");
temph1.put("dataIndex","pointNum");
temph1.put("name"," 巡检点编号");
temph1.put("title","巡检点编号");
temph1.put("type","dataGrid");
temph1.put("key","pointNum");
colModel.add(temph1);
HashMap<String, Object> temph0 = new HashMap<>();
temph0.put("fid","name");
temph0.put("dataIndex","name");
temph0.put("name"," 巡检点名称");
temph0.put("title","巡检点名称");
temph0.put("type","dataGrid");
temph0.put("key","name");
colModel.add(temph0);
HashMap<String, Object> temph3 = new HashMap<>();
temph3.put("fid","bizOrgName");
temph3.put("dataIndex","bizOrgName");
temph3.put("name"," 所属部门");
temph3.put("title","所属部门");
temph3.put("type","dataGrid");
temph3.put("key","bizOrgName");
colModel.add(temph3);
HashMap<String, Object> temph4 = new HashMap<>();
temph4.put("fid","actor");
temph4.put("dataIndex","actor");
temph4.put("name"," 执行人");
temph4.put("title","执行人");
temph4.put("type","dataGrid");
temph4.put("key","actor");
colModel.add(temph4);
HashMap<String, Object> dataGridMock = new HashMap<>();
dataGridMock.put("current",result.getNumber()+1);
dataGridMock.put("total",result.getTotalElements());
dataGridMock.put("pagination",false);
dataGridMock.put("totalPage",result.getTotalPages());
dataGridMock.put("dataList",result.getContent());
dataGridMock.put("pageSize",result.getSize());
HashMap<String, Object> DATE = new HashMap<>();
DATE.put("dataGridMock",dataGridMock);
DATE.put("colModel",colModel);
HashMap<String, Object> temph = new HashMap<>();
temph.put("result",DATE);
temph.put("status",200);
temph.put("message","");
return temph;
}
}
......@@ -177,13 +177,13 @@ public interface ITaskService {
List<Map<String, Object>> getStatisticsByTypeHG( String name, String timeType);
//根据日线路(今日),月线路(当月)。季度线路(本季度),年线路(本年) 获取线路关键区域
List<Map<String,Object>> getLinetype( String nameType);
HashMap<String, Object> getLinetype( int pageNumber,int pageSize,String nameType);
//根据线路关键字过滤,日线路(今日),月线路(当月)。季度线路(本季度),年线路(本年) 不合格
Page <Map<String,Object>> getLinetypeUnqualified(int offset,int pageSize, String nameType,String timeType);
HashMap<String, Object> getLinetypeUnqualified(int offset,int pageSize, String nameType,String timeType);
//根据线路关键字过滤,日线路(今日),月线路(当月)。季度线路(本季度),年线路(本年) 未巡检
Page<Map<String,Object>> getLinetypeNotInspected( int offset,int pageSize,String nameType, String timeType);
HashMap<String, Object> getLinetypeNotInspected( int offset,int pageSize,String nameType, String timeType);
......
......@@ -1156,27 +1156,27 @@
( ifnull( sum( p_plan_task.`point_num` ), 0 ) - ifnull( sum( p_plan_task.`finish_num` ), 0 ) ) AS `wxj`
from p_plan_task left join p_plan
on p_plan_task.plan_id=p_plan.id
where
<where>
<choose>
<when test="timeType == 'd'">
to_days(p_plan_task.begin_time) = to_days(curdate())
<when test="timeType == 'dt'">
and DATE(p_plan_task.begin_time) = DATE(curdate())
</when>
<when test="timeType == 'm'">
month(p_plan_task.begin_time) =month(curdate()) and year(p_plan_task.begin_time) = year(curdate())
<when test="timeType == 'mt'">
and month(p_plan_task.begin_time) =month(curdate()) and year(p_plan_task.begin_time) = year(curdate())
</when>
<when test="timeType == 'j'">
QUARTER(p_plan_task.begin_time) =QUARTER(curdate())
<when test="timeType == 'jt'">
and QUARTER(p_plan_task.begin_time) =QUARTER(curdate())
</when>
<when test="timeType == 'yr'">
year( p_plan_task.begin_time ) = year( curdate( ))
<when test="timeType == 'yrt'">
and year( p_plan_task.begin_time ) = year( curdate( ))
</when>
</choose>
<if test="name != null and name!=''">
SUBSTRING_INDEX( p_plan.`name`,'-',-1)=#{name}
and p_plan.`name` like CONCAT( '%',#{name}, '%')
</if>
</where>
</select>
<select id="getStatisticsByTypeHG" resultType="java.util.Map">
......@@ -1187,33 +1187,52 @@
on p_plan_task.plan_id=p_plan.id
LEFT JOIN p_plan_task_detail
ON p_plan_task_detail.task_no=p_plan_task.id
where
<where>
<choose>
<when test="timeType == 'd'">
to_days(p_plan_task.begin_time) = to_days(curdate())
<when test="timeType == 'dt'">
and DATE(p_plan_task.begin_time) = DATE(curdate())
</when>
<when test="timeType == 'm'">
month(p_plan_task.begin_time) =month(curdate()) and year(p_plan_task.begin_time) = year(curdate())
<when test="timeType == 'mt'">
and month(p_plan_task.begin_time) =month(curdate()) and year(p_plan_task.begin_time) = year(curdate())
</when>
<when test="timeType == 'j'">
QUARTER(p_plan_task.begin_time) =QUARTER(curdate())
<when test="timeType == 'jt'">
and QUARTER(p_plan_task.begin_time) =QUARTER(curdate())
</when>
<when test="timeType == 'yr'">
year( p_plan_task.begin_time ) = year( curdate( ))
<when test="timeType == 'yrt'">
and year( p_plan_task.begin_time ) = year( curdate( ))
</when>
</choose>
<if test="name != null and name!=''">
SUBSTRING_INDEX( p_plan.`name`,'-',-1)=#{name}
and p_plan.`name` like CONCAT('%',#{name}, '%')
</if>
</where>
</select>
<select id="getLinetype" resultType="java.util.Map">
select SUBSTRING_INDEX(p_plan.name,'-',-1) as `name` from p_plan
select
distinct SUBSTRING_INDEX(p_plan.name,'-',-1) as `name_measure` from p_plan
<where>
<if test="name != null and name!=''">
SUBSTRING_INDEX( p_plan.`name`,'-',-1)=#{name}
p_plan.`name` like CONCAT('%',#{name}, '%')
</if>
</where>
limit #{offset},#{pageSize}
</select>
<select id="getLinetypecount" resultType="long">
select
COUNT(1) AS num from p_plan
<where>
<if test="name != null and name!=''">
p_plan.`name` like CONCAT('%',#{name}, '%')
</if>
</where>
</select>
<select id="countLinetypeUnqualified" resultType="long">
SELECT
......@@ -1231,33 +1250,33 @@
RIGHT JOIN p_plan_task_detail pptd ON ppt.ID = pptd.TASK_NO
LEFT JOIN p_plan pp ON ppt.plan_id = pp.id
LEFT JOIN p_point ppo ON ppo.id = pptd.point_id
WHERE
<where>
pptd.`status` = 2
<if test="name != null and name !=''">
SUBSTRING_INDEX( p_plan.`name`,'-',-1)=#{name}
</if>
ORDER BY
pptd.create_date DESC
) a
GROUP BY
pointNum
having
and pp.`name` like CONCAT('%',#{name}, '%')
</if>
<choose>
<when test="timeType == 'd'">
to_days(create_date) = to_days(curdate())
<when test="timeType == 'dt'">
and DATE(pptd.create_date) = DATE(curdate())
</when>
<when test="timeType == 'm'">
month(create_date) =month(curdate()) and year(create_date) = year(curdate())
<when test="timeType == 'mt'">
and month(pptd.create_date) =month(curdate()) and year(pptd.create_date) = year(curdate())
</when>
<when test="timeType == 'j'">
QUARTER(create_date) =QUARTER(curdate())
<when test="timeType == 'jt'">
and QUARTER(pptd.create_date) =QUARTER(curdate())
</when>
<when test="timeType == 'yr'">
year( create_date ) = year( curdate( ))
<when test="timeType == 'yrt'">
and year( pptd.create_date ) = year( curdate( ))
</when>
</choose>
</where>
GROUP BY
ppo.point_no
) a
</select>
<select id="getLinetypeUnqualified" resultType="java.util.Map">
SELECT
......@@ -1265,50 +1284,56 @@
FROM
(
SELECT
ppo.point_no pointNum,
ppo.`name`,
ppo.biz_org_name bizOrgName,
pptd.executor_name AS actor,
pptd.create_date
ppo.point_no pointNum_measure1,
ppo.point_no pointNum_measure,
ppo.`name` name_measure,
ppo.biz_org_name bizOrgName_measure,
pptd.executor_name AS actor_measure,
pptd.create_date create_date_measure
FROM
p_plan_task ppt
RIGHT JOIN p_plan_task_detail pptd ON ppt.ID = pptd.TASK_NO
LEFT JOIN p_plan pp ON ppt.plan_id = pp.id
LEFT JOIN p_point ppo ON ppo.id = pptd.point_id
WHERE
<where>
pptd.`status` = 2
<if test="name != null and name !=''">
SUBSTRING_INDEX( p_plan.`name`,'-',-1)=#{name}
and pp.`name` like CONCAT('%',#{name}, '%')
</if>
ORDER BY
pptd.create_date DESC
) a
GROUP BY
pointNum
having
<choose>
<when test="timeType == 'd'">
to_days(create_date) = to_days(curdate())
<when test="timeType == 'dt'">
and DATE(pptd.create_date) = DATE(curdate())
</when>
<when test="timeType == 'm'">
month(create_date) =month(curdate()) and year(create_date) = year(curdate())
<when test="timeType == 'mt'">
and month(pptd.create_date) =month(curdate()) and year(pptd.create_date) = year(curdate())
</when>
<when test="timeType == 'j'">
QUARTER(create_date) =QUARTER(curdate())
<when test="timeType == 'jt'">
and QUARTER(pptd.create_date) =QUARTER(curdate())
</when>
<when test="timeType == 'yr'">
year( create_date ) = year( curdate( ))
<when test="timeType == 'yrt'">
and year( pptd.create_date ) = year( curdate( ))
</when>
</choose>
</where>
GROUP BY
ppo.point_no
ORDER BY
pptd.create_date DESC
) a
limit #{offset},#{pageSize}
</select>
<select id="countLinetypeNotInspected" resultType="long">
select COUNT(* ) AS num from (
SELECT
COUNT(1) AS num
ppo.point_no pointNum,
ppo.route_name routeName,
ppo.`name`,
ppo.biz_org_name bizOrgName,
pr.boss_name AS actor,
pc.create_date checkDate
FROM
p_plan_task ppt
RIGHT JOIN p_plan_task_detail pptd ON ppt.ID = pptd.TASK_NO
......@@ -1316,28 +1341,30 @@
LEFT JOIN p_point ppo ON ppo.id = pptd.point_id
LEFT JOIN p_check pc ON pptd.id = pc.plan_task_detail_id
LEFT JOIN p_route pr ON pr.id = ppt.route_id
WHERE
<where>
pptd.`is_finish` != 1
<choose>
<when test="timeType == 'd'">
to_days(ppt.begin_time) = to_days(curdate())
<when test="timeType == 'dt'">
and DATE(ppt.begin_time) = DATE(curdate())
</when>
<when test="timeType == 'm'">
month(ppt.begin_time) =month(curdate()) and year(ppt.begin_time) = year(curdate())
<when test="timeType == 'mt'">
and month(ppt.begin_time) =month(curdate()) and year(ppt.begin_time) = year(curdate())
</when>
<when test="timeType == 'j'">
QUARTER(ppt.begin_time) =QUARTER(curdate())
<when test="timeType == 'jt'">
and QUARTER(ppt.begin_time) =QUARTER(curdate())
</when>
<when test="timeType == 'yr'">
year( ppt.begin_time ) = year( curdate( ))
<when test="timeType == 'yrt'">
and year( ppt.begin_time ) = year( curdate( ))
</when>
</choose>
<if test="name != null and name !=''">
SUBSTRING_INDEX( pp.`name`,'-',-1)=#{name}
and pp.`name` like CONCAT('%',#{name}, '%')
</if>
</where>
GROUP BY
ppo.point_no
) a
</select>
......@@ -1348,12 +1375,12 @@
FROM
(
SELECT
ppo.point_no pointNum,
ppo.route_name routeName,
ppo.`name`,
ppo.biz_org_name bizOrgName,
pr.boss_name AS actor,
pc.create_date checkDate
ppo.point_no pointNum_measure,
ppo.route_name routeName_measure,
ppo.`name` name_measure,
ppo.biz_org_name bizOrgName_measure,
pr.boss_name AS actor_measure,
pc.create_date checkDate_measure
FROM
p_plan_task ppt
RIGHT JOIN p_plan_task_detail pptd ON ppt.ID = pptd.TASK_NO
......@@ -1361,31 +1388,33 @@
LEFT JOIN p_point ppo ON ppo.id = pptd.point_id
LEFT JOIN p_check pc ON pptd.id = pc.plan_task_detail_id
LEFT JOIN p_route pr ON pr.id = ppt.route_id
WHERE
<where>
pptd.`is_finish` != 1
<choose>
<when test="timeType == 'd'">
to_days(ppt.begin_time) = to_days(curdate())
<when test="timeType == 'dt'">
and DATE(ppt.begin_time) = DATE(curdate())
</when>
<when test="timeType == 'm'">
month(ppt.begin_time) =month(curdate()) and year(ppt.begin_time) = year(curdate())
<when test="timeType == 'mt'">
and month(ppt.begin_time) =month(curdate()) and year(ppt.begin_time) = year(curdate())
</when>
<when test="timeType == 'j'">
QUARTER(ppt.begin_time) =QUARTER(curdate())
<when test="timeType == 'jt'">
and QUARTER(ppt.begin_time) =QUARTER(curdate())
</when>
<when test="timeType == 'yr'">
year( ppt.begin_time ) = year( curdate( ))
<when test="timeType == 'yrt'">
and year( ppt.begin_time ) = year( curdate( ))
</when>
</choose>
<if test="name != null and name !=''">
SUBSTRING_INDEX( pp.`name`,'-',-1)=#{name}
and pp.`name` like CONCAT('%',#{name}, '%')
</if>
</where>
GROUP BY
ppo.point_no
ORDER BY
pptd.create_date DESC
) a
GROUP BY
pointNum
limit #{offset},#{pageSize}
</select>
......
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