Commit e9c364ff authored by suhuiguang's avatar suhuiguang

1.维保日历

parent 2c193bb5
...@@ -6,7 +6,7 @@ public class CalendarStatusCountRespone { ...@@ -6,7 +6,7 @@ public class CalendarStatusCountRespone {
/** /**
* 个数 * 个数
*/ */
private double count; private Double count;
/** /**
* 状态 * 状态
*/ */
......
...@@ -299,24 +299,19 @@ public class CheckController extends AbstractBaseController { ...@@ -299,24 +299,19 @@ public class CheckController extends AbstractBaseController {
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取巡检日历数据<font color='blue'>手机app</font>", notes = "获取巡检日历数据<font color='blue'>手机app</font>") @ApiOperation(value = "获取巡检日历数据-mobile", notes = "获取巡检日历数据-mobile")
@PostMapping(value = "/checkCalendar", produces = "application/json;charset=UTF-8") @GetMapping(value = "/{date}/checkCalendar", produces = "application/json;charset=UTF-8")
public CommonResponse checkCalendar( public CommonResponse checkCalendar(
@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests) { @ApiParam(value = "date,格式YYYY-MM-DD",required = true)@PathVariable String date) {
try { HashMap<String, Object> params = new HashMap<>();
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams); String loginOrgCode = getOrgCode(reginParams);
String roleTypeName = getRoleTypeName(reginParams); Map<String, Object> authMap = Bean.BeantoMap(reginParams.getPersonIdentity());
List<DaoCriteria> daoCriterias = buildDaoCriterias(queryRequests, true, loginOrgCode, roleTypeName); params.putAll(authMap);
params.put("checkTime", date);
params.put("orgCode", loginOrgCode);
Map<String, Object> map = checkService.checkCalendar(CheckParamUtil.checkCalendar(daoCriterias)); Map<String, Object> map = checkService.checkCalendar(params);
return CommonResponseUtil.success(map); return CommonResponseUtil.success(map);
} catch (Exception e) {
e.printStackTrace();
return CommonResponseUtil.failure(e.getMessage());
}
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
...@@ -347,13 +342,8 @@ public class CheckController extends AbstractBaseController { ...@@ -347,13 +342,8 @@ public class CheckController extends AbstractBaseController {
@ApiOperation(value = "获取巡检记录详情信息<font color='blue'>手机app</font>", notes = "获取巡检记录详情信息<font color='blue'>手机app</font>") @ApiOperation(value = "获取巡检记录详情信息<font color='blue'>手机app</font>", notes = "获取巡检记录详情信息<font color='blue'>手机app</font>")
@RequestMapping(value = "/queryCheckDetail", produces = "application/json;charset=UTF-8", method = RequestMethod.GET) @RequestMapping(value = "/queryCheckDetail", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryRecordById(@RequestParam(required = true) int checkId) { public CommonResponse queryRecordById(@RequestParam(required = true) int checkId) {
try { Map<String, Object> map = checkService.queryRecordById(checkId);
Map<String, Object> map = checkService.queryRecordById(checkId); return CommonResponseUtil.success(map);
return CommonResponseUtil.success(map);
} catch (Exception e) {
e.printStackTrace();
return CommonResponseUtil.failure(e.getMessage());
}
} }
/** /**
......
...@@ -45,14 +45,14 @@ public interface CheckMapper extends BaseMapper { ...@@ -45,14 +45,14 @@ public interface CheckMapper extends BaseMapper {
* @param param * @param param
* @return * @return
*/ */
Map<String,Object> pieChartData(CheckRecordParam param); Map<String,Object> pieChartData(Map<String,Object> param);
/** /**
* 巡检日历日历数据 * 巡检日历日历数据
* @param param * @param param
* @return * @return
*/ */
List<Map<String,Object>> calendarData(CheckRecordParam param); List<Map<String,Object>> calendarData(Map<String,Object> param);
List<Map<String, Object>> queryRecordByPointId(HashMap<String, Object> req); List<Map<String, Object>> queryRecordByPointId(HashMap<String, Object> req);
......
...@@ -624,26 +624,16 @@ public class CheckServiceImpl implements ICheckService { ...@@ -624,26 +624,16 @@ public class CheckServiceImpl implements ICheckService {
} }
@Override @Override
public Map<String, Object> checkCalendar(CheckRecordParam recordParam) { public Map<String, Object> checkCalendar(Map<String, Object> param) {
Map<String, Object> charData = checkMapper.pieChartData(recordParam); Map<String, Object> charData = checkMapper.pieChartData(param);
List<Map<String, Object>> calendarData = checkMapper.calendarData(recordParam); List<Map<String, Object>> calendarData = checkMapper.calendarData(param);
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
Map<String, List<CalendarStatusCountRespone>> calendarMap = new HashMap<>(); Map<String,List<CalendarStatusCountRespone>> calendarMap = calendarData.stream().collect(Collectors.groupingBy(map -> map.get("time").toString(),Collectors.mapping(c->{
if (!calendarData.isEmpty()) { CalendarStatusCountRespone countRespone = new CalendarStatusCountRespone();
calendarData.forEach(action -> { countRespone.setCount(Long.parseLong(c.get("count").toString()));
List<CalendarStatusCountRespone> statusCountList = new ArrayList<>(); countRespone.setStatus(c.get("status").toString());
CalendarStatusCountRespone statusCount = new CalendarStatusCountRespone(); return countRespone;
statusCount.setCount(Double.valueOf(action.get("count").toString())); },Collectors.toList())));
statusCount.setStatus(action.get("status").toString());
if (calendarMap.containsKey(action.get("time"))) {
statusCountList = calendarMap.get(action.get("time"));
statusCountList.add(statusCount);
} else {
statusCountList.add(statusCount);
calendarMap.put(action.get("time").toString(), statusCountList);
}
});
}
result.put("charData", charData); result.put("charData", charData);
result.put("calendarData", calendarMap); result.put("calendarData", calendarMap);
return result; return result;
......
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.maintenance.business.service.impl; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.maintenance.business.service.impl;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Sequence; import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.baomidou.mybatisplus.extension.api.R;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
...@@ -35,6 +36,7 @@ import org.springframework.data.domain.*; ...@@ -35,6 +36,7 @@ import org.springframework.data.domain.*;
import org.springframework.data.domain.Sort.Direction; import org.springframework.data.domain.Sort.Direction;
import org.springframework.data.domain.Sort.Order; import org.springframework.data.domain.Sort.Order;
import org.springframework.data.jpa.domain.Specification; import org.springframework.data.jpa.domain.Specification;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -228,26 +230,19 @@ public class PointServiceImpl implements IPointService { ...@@ -228,26 +230,19 @@ public class PointServiceImpl implements IPointService {
if (!pointInputItems.isEmpty()) { if (!pointInputItems.isEmpty()) {
iPointInputItemDao.saveAll(pointInputItems); iPointInputItemDao.saveAll(pointInputItems);
} }
//TODO 2.分类暂时不需要 维保
} }
@Override @Override
@Transactional @Transactional(rollbackFor = Exception.class)
public List<Long> delPointById(Long[] ids) { public List<Long> delPointById(Long[] ids) {
List<Long> idList = new ArrayList<Long>(); List<Long> idList = new ArrayList<Long>();
for (long pointId : ids) { idList.addAll(Arrays.asList(ids));
idList.add(pointId);
}
iPointClassifyDao.deleteByPointId(idList); // 物理删除点的分类
List<PointInputItem> pointInputItem = iPointInputItemDao.findAllById(idList); List<PointInputItem> pointInputItem = iPointInputItemDao.findAllById(idList);
List<Long> pointInputItemIds = Lists.transform(pointInputItem, PointInputItem::getId); List<Long> pointInputItemIds = Lists.transform(pointInputItem, PointInputItem::getId);
if (pointInputItemIds.size() > 0) // 物理删除p_point_inputitem表对应行
iPointInputItemDao.deleteFmeaRelationByPointInputItemIds(pointInputItemIds);//物理删除fmea关联巡检点项 iPointInputItemDao.deleteByPointId(idList);
iPointInputItemDao.deleteByPointId(idList); // 物理删除p_point_inputitem表对应行 // 物理删除p_route_point、p_route_point_item中相关行
iPointPhotoDao.deleteByPointId(idList); // 物理删除点的图片信息
// iRoutePointDao.delRoutePointByPointId(idList); //
// 物理删除p_route_point中相关行
List<BigInteger> routePointIdList = iRoutePointDao.queryRoutePointByPointId(idList); List<BigInteger> routePointIdList = iRoutePointDao.queryRoutePointByPointId(idList);
for (BigInteger routePointId : routePointIdList) { for (BigInteger routePointId : routePointIdList) {
iRoutePointItemDao.delRoutePointItem(routePointId.longValue()); iRoutePointItemDao.delRoutePointItem(routePointId.longValue());
...@@ -270,18 +265,19 @@ public class PointServiceImpl implements IPointService { ...@@ -270,18 +265,19 @@ public class PointServiceImpl implements IPointService {
} }
} }
} }
// 删除p_plan_task_detail相关行
iPlanTaskDetailDao.deletePlanTaskDetailByPointId(idList); // 删除p_plan_task_detail相关行 iPlanTaskDetailDao.deletePlanTaskDetailByPointId(idList);
// 删除p_point相关行
iPointDao.delPointById(idList); iPointDao.delPointById(idList);
return idList; return idList;
} }
@Override @Override
@Transactional @Transactional(rollbackFor = Exception.class)
public Point updatePoint(PointParam pointParam) { public Point updatePoint(PointParam pointParam) {
//1.更新点 //1.更新点
long pointId = pointParam.getPoint().getId(); long pointId = pointParam.getPoint().getId();
Point newPoint = iPointDao.findById(pointId).get(); Point newPoint = iPointDao.findById(pointId).orElseThrow(()->new RuntimeException("找不到原始数据"));
Bean.copyExistPropertis(pointParam.getPoint(), newPoint); Bean.copyExistPropertis(pointParam.getPoint(), newPoint);
newPoint.setLastUpdateTime(new Date()); newPoint.setLastUpdateTime(new Date());
iPointDao.save(newPoint); iPointDao.save(newPoint);
...@@ -346,9 +342,9 @@ public class PointServiceImpl implements IPointService { ...@@ -346,9 +342,9 @@ public class PointServiceImpl implements IPointService {
public Page<PointVo> queryPointInfo(List<DaoCriteria> criterias, CommonPageable commonPageable, String loginOrgCode) { public Page<PointVo> queryPointInfo(List<DaoCriteria> criterias, CommonPageable commonPageable, String loginOrgCode) {
BaseQuerySpecification<Point> spec = new BaseQuerySpecification<>(criterias); BaseQuerySpecification<Point> spec = new BaseQuerySpecification<>(criterias);
Order idOrder = new Order(Direction.DESC, "id"); Order idOrder = new Order(Direction.DESC, "id");
List<Order> orders = new ArrayList<Order>(); List<Order> orders = new ArrayList<Order>();
orders.add(idOrder); orders.add(idOrder);
Sort sort = Sort.by(orders); Sort sort = Sort.by(orders);
commonPageable.setSort(sort); commonPageable.setSort(sort);
Page<Point> pointPage = iPointDao.findAll(spec, commonPageable); Page<Point> pointPage = iPointDao.findAll(spec, commonPageable);
List<PointInputItem> pointInputItems = iPointInputItemDao.findAll(); List<PointInputItem> pointInputItems = iPointInputItemDao.findAll();
...@@ -367,9 +363,9 @@ public class PointServiceImpl implements IPointService { ...@@ -367,9 +363,9 @@ public class PointServiceImpl implements IPointService {
public List<PointVo> queryAllPoint(List<DaoCriteria> criterias) { public List<PointVo> queryAllPoint(List<DaoCriteria> criterias) {
BaseQuerySpecification<Point> spec = new BaseQuerySpecification<>(criterias); BaseQuerySpecification<Point> spec = new BaseQuerySpecification<>(criterias);
Order idOrder = new Order(Direction.DESC, "id"); Order idOrder = new Order(Direction.DESC, "id");
List<Order> orders = new ArrayList<Order>(); List<Order> orders = new ArrayList<Order>();
orders.add(idOrder); orders.add(idOrder);
Sort sort = Sort.by(orders); Sort sort = Sort.by(orders);
List<PointVo> returnList = new ArrayList<>(); List<PointVo> returnList = new ArrayList<>();
List<Point> list = iPointDao.findAll(spec, sort); List<Point> list = iPointDao.findAll(spec, sort);
if (!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {
...@@ -381,6 +377,7 @@ public class PointServiceImpl implements IPointService { ...@@ -381,6 +377,7 @@ public class PointServiceImpl implements IPointService {
} }
return returnList; return returnList;
} }
@Override @Override
public List<PointInputItemVo> queryPointInputItem(Long pointId) { public List<PointInputItemVo> queryPointInputItem(Long pointId) {
return pointMapper.getPointInputItemById1(pointId, null); return pointMapper.getPointInputItemById1(pointId, null);
...@@ -1089,11 +1086,27 @@ public class PointServiceImpl implements IPointService { ...@@ -1089,11 +1086,27 @@ public class PointServiceImpl implements IPointService {
return equipFeign.getRegionTress(); return equipFeign.getRegionTress();
} }
@Override @Override
@Async
public void syncSavePoint(List<MaintenanceResourceData> list, String orgCode, String userId) { public void syncSavePoint(List<MaintenanceResourceData> list, String orgCode, String userId) {
List<Point> points = new ArrayList<>(); List<Point> points = new ArrayList<>();
List<PointInputItem> inputItems = new ArrayList<>(); List<PointInputItem> inputItems = new ArrayList<>();
List<Long> ids = new ArrayList<Long>(); List<Long> ids = new ArrayList<>();
//1.删除已有数据
for (MaintenanceResourceData x : list) {
String pointNo = x.getFireFacilityCode();
String originalId = String.valueOf(x.getFireFacilityId());
Long id = iPointDao.findPointByEquipmentIdAndFireFacilityId(pointNo, originalId);
if (null != id) {
ids.add(id);
}
}
if (!ids.isEmpty()) {
Long[] idsArray = ids.toArray(new Long[0]);
delPointById(idsArray);
}
//2.创建
for (MaintenanceResourceData x : list) { for (MaintenanceResourceData x : list) {
Point point = new Point(); Point point = new Point();
String pointNo = StringUtil.isNotEmpty(x.getFireFacilityCode()) ? x.getFireFacilityCode() : String.valueOf(sequence.nextId()); String pointNo = StringUtil.isNotEmpty(x.getFireFacilityCode()) ? x.getFireFacilityCode() : String.valueOf(sequence.nextId());
...@@ -1107,16 +1120,13 @@ public class PointServiceImpl implements IPointService { ...@@ -1107,16 +1120,13 @@ public class PointServiceImpl implements IPointService {
point.setBelongSystemName(x.getFireFightSysName()); point.setBelongSystemName(x.getFireFightSysName());
point.setOwnerId(String.valueOf(x.getOwnerUnitId())); point.setOwnerId(String.valueOf(x.getOwnerUnitId()));
point.setOwnerName(x.getOwnerUnitName()); point.setOwnerName(x.getOwnerUnitName());
point.setAddress(x.getLocation()); point.setBuildingId(x.getBuildingId() != null ? x.getBuildingId().toString() : "");
point.setBuildingName(x.getBuildingName());
point.setAddress(x.getArea());
point.setLevel(""); point.setLevel("");
point.setCreatorId(userId); point.setCreatorId(userId);
point.setOrgCode(orgCode); point.setOrgCode(orgCode);
points.add(point); points.add(point);
Long id = iPointDao.findPointByEquipmentIdAndFireFacilityId(pointNo, originalId);
if (null != id) {
ids.add(id);
iPointDao.delPointBIds(id);
}
iPointDao.save(point); iPointDao.save(point);
List<InputItem> inputItemVos = inputItemMapper.getInputItemByEquipmentName(x.getClassifyName(), orgCode); List<InputItem> inputItemVos = inputItemMapper.getInputItemByEquipmentName(x.getClassifyName(), orgCode);
if (0 < inputItemVos.size()) { if (0 < inputItemVos.size()) {
...@@ -1129,9 +1139,6 @@ public class PointServiceImpl implements IPointService { ...@@ -1129,9 +1139,6 @@ public class PointServiceImpl implements IPointService {
}); });
} }
} }
if (0 < ids.size()) {
iPointInputItemDao.deleteByPointId(ids);
}
iPointInputItemDao.saveAll(inputItems); iPointInputItemDao.saveAll(inputItems);
} }
...@@ -1139,9 +1146,9 @@ public class PointServiceImpl implements IPointService { ...@@ -1139,9 +1146,9 @@ public class PointServiceImpl implements IPointService {
public Page<PointDto> queryPointInfoWithItem(List<DaoCriteria> criterias, CommonPageable cPageable, Long ownerId) { public Page<PointDto> queryPointInfoWithItem(List<DaoCriteria> criterias, CommonPageable cPageable, Long ownerId) {
BaseQuerySpecification<Point> spec = new BaseQuerySpecification<>(criterias); BaseQuerySpecification<Point> spec = new BaseQuerySpecification<>(criterias);
Order idOrder = new Order(Direction.DESC, "id"); Order idOrder = new Order(Direction.DESC, "id");
List<Order> orders = new ArrayList<Order>(); List<Order> orders = new ArrayList<Order>();
orders.add(idOrder); orders.add(idOrder);
Sort sort = Sort.by(orders); Sort sort = Sort.by(orders);
cPageable.setSort(sort); cPageable.setSort(sort);
Page<Point> pointPage = iPointDao.findAll(spec, cPageable); Page<Point> pointPage = iPointDao.findAll(spec, cPageable);
List<PointInputItem> pointInputItems = iPointInputItemDao.findAll(); List<PointInputItem> pointInputItems = iPointInputItemDao.findAll();
......
...@@ -66,7 +66,7 @@ public interface ICheckService { ...@@ -66,7 +66,7 @@ public interface ICheckService {
* @param requestParam * @param requestParam
* @return * @return
*/ */
Map<String, Object> checkCalendar(CheckRecordParam requestParam); Map<String, Object> checkCalendar(Map<String, Object> requestParam);
/** /**
* 根据点ID查询点巡检记录 手机APP * 根据点ID查询点巡检记录 手机APP
......
...@@ -297,7 +297,7 @@ public interface IPointService { ...@@ -297,7 +297,7 @@ public interface IPointService {
List queryItemList4RoutePoint(Long pointId, Long equipId); List queryItemList4RoutePoint(Long pointId, Long equipId);
LinkedHashMap<String,Object> getRegionTress (); LinkedHashMap<String,Object> getRegionTress();
void syncSavePoint(List<MaintenanceResourceData> list, String orgCode, String userId); void syncSavePoint(List<MaintenanceResourceData> list, String orgCode, String userId);
/** /**
......
package com.yeejoin.amos.maintenance.business.vo; package com.yeejoin.amos.maintenance.business.vo;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import lombok.Data; import lombok.Data;
...@@ -53,7 +52,6 @@ public class MaintenanceResourceData { ...@@ -53,7 +52,6 @@ public class MaintenanceResourceData {
/** /**
* 业主单位名称 * 业主单位名称
*/ */
@Excel(name = "所属单位", width = 30, orderNum = "7")
private String ownerUnitName; private String ownerUnitName;
/** /**
...@@ -69,7 +67,6 @@ public class MaintenanceResourceData { ...@@ -69,7 +67,6 @@ public class MaintenanceResourceData {
/** /**
* 消防系统名称 * 消防系统名称
*/ */
@Excel(name = "所属消防系统", width = 30, orderNum = "4")
private String fireFightSysName; private String fireFightSysName;
/** /**
...@@ -85,7 +82,6 @@ public class MaintenanceResourceData { ...@@ -85,7 +82,6 @@ public class MaintenanceResourceData {
/** /**
* 分类名称 * 分类名称
*/ */
@Excel(name = "设施类型", width = 30, orderNum = "3")
private String classifyName; private String classifyName;
/** /**
...@@ -101,13 +97,11 @@ public class MaintenanceResourceData { ...@@ -101,13 +97,11 @@ public class MaintenanceResourceData {
/** /**
* 消防设施编码 * 消防设施编码
*/ */
@Excel(name = "设施编码", width = 30, orderNum = "6")
private String fireFacilityCode; private String fireFacilityCode;
/** /**
* 消防设施名称 * 消防设施名称
*/ */
@Excel(name = "设施名称", width = 30, orderNum = "1")
private String fireFacilityName; private String fireFacilityName;
/** /**
...@@ -116,29 +110,10 @@ public class MaintenanceResourceData { ...@@ -116,29 +110,10 @@ public class MaintenanceResourceData {
private String fireFacilityType; private String fireFacilityType;
/** /**
* 维保到期时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "到期维保时间", exportFormat = "yyyy-MM-dd HH:mm:ss", importFormat = "yyyy-MM-dd HH:mm:ss", width = 30, orderNum = "5")
private Date maintenanceExpirationTime;
/**
* 位置 * 位置
*/ */
@Excel(name = "安装或设置位置", width = 50, orderNum = "2")
private String location; private String location;
/**
* 建筑层级IDS
*/
private String buildTierIds;
/**
* 新增和更新执行
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "添加时间", exportFormat = "yyyy-MM-dd HH:mm:ss", importFormat = "yyyy-MM-dd HH:mm:ss", width = 30, orderNum = "8")
private Date createDate;
/** /**
* 建筑ID * 建筑ID
...@@ -150,17 +125,12 @@ public class MaintenanceResourceData { ...@@ -150,17 +125,12 @@ public class MaintenanceResourceData {
*/ */
private String buildingName; private String buildingName;
/**
* 是否已关联
*/
private List<Long> buildingIds;
/** /**
* 是否已关联 * 详情位置
*/ */
private Boolean isRelation; private String area;
// public void setRelation(Boolean relation) {
// isRelation = relation == null ? null : false;
// }
} }
...@@ -286,13 +286,22 @@ ...@@ -286,13 +286,22 @@
COUNT(id) count COUNT(id) count
FROM FROM
p_check p_check
WHERE <include refid="calendar-where"/>
DATE_FORMAT(check_time, '%Y-%m') = #{checkTime}
<if test="userId!=null and userId!=0">AND FIND_IN_SET(#{userId}, user_id)>0</if>
<if test="routeId!=null and routeId!=0">AND route_id = #{routeId}</if>
<if test="orgCode!=null">AND org_code LIKE #{orgCode}</if>
</select> </select>
<sql id="calendar-where">
<where>
DATE_FORMAT(check_time, '%Y-%m') = #{checkTime}
<choose>
<when test="identityType==1">
And (org_code LIKE CONCAT( #{orgCode}, '-%' ) or org_code= #{orgCode} )
</when>
<when test="identityType==2">
And owner_id = #{companyId}
</when>
</choose>
</where>
</sql>
<select id="calendarData" resultType="Map"> <select id="calendarData" resultType="Map">
SELECT SELECT
sum(is_ok) AS count, sum(is_ok) AS count,
...@@ -300,11 +309,7 @@ ...@@ -300,11 +309,7 @@
is_ok status is_ok status
FROM FROM
p_check p_check
WHERE <include refid="calendar-where"/>
DATE_FORMAT(check_time, '%Y-%m') = #{checkTime}
<if test="userId!=null and userId!=0">AND FIND_IN_SET(#{userId}, user_id)>0</if>
<if test="routeId!=null and routeId!=0">AND route_id = #{routeId}</if>
<if test="orgCode!=null">AND org_code LIKE #{orgCode}</if>
GROUP BY is_ok,time GROUP BY is_ok,time
ORDER BY time ORDER BY time
</select> </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