Commit ae7338f7 authored by limei's avatar limei

修改 根据模型id和机构id查询检查项总数和不合格总数

parent 3b31990b
......@@ -19,4 +19,9 @@ public class CheckResultDto {
private String name;
private String total;
private String aaa;
}
package com.yeejoin.amos.boot.module.tdc.api.dto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
@Data
@Accessors(chain = true)
@TableName("tdc_check_result")
public class CheckTotalDto {
private static final long serialVersionUID = 1L;
@TableId(value = "sequence_nbr", type = IdType.ID_WORKER)
protected Long sequenceNbr;
@ApiModelProperty(value="校验时间")
private Date checkDate;
@ApiModelProperty(value="模型名称")
private String name;
private String modelName;
private int allTotal;
private int failTotal;
private String checkItemLabel;
private String modelId;
private String checkItemValue;
private String checkExplain;
private String amosOrgCode;
private String total;
private String aaa;
}
......@@ -5,7 +5,6 @@ import com.yeejoin.amos.boot.module.tdc.api.dto.CheckResultDto;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckResult;
import org.mapstruct.Mapper;
import java.util.Date;
import java.util.List;
/**
......@@ -16,4 +15,6 @@ public interface CheckResultMapper extends BaseMapper<CheckResult> {
List<CheckResultDto> selectResult(String code);
List<CheckResultDto> selectTotal(String modelId, String amosOrgCode);
}
package com.yeejoin.amos.boot.module.tdc.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.tdc.api.dto.CheckResultDto;
import com.yeejoin.amos.boot.module.tdc.api.dto.CheckTotalDto;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckResult;
import org.mapstruct.Mapper;
import java.util.List;
@Mapper
public interface CheckTotalMapper extends BaseMapper<CheckTotalDto> {
List<CheckTotalDto> selectTotal(String modelId,String amosOrgCode);
}
......@@ -16,4 +16,6 @@ public interface CheckResultService extends IService<CheckResult> {
List<CheckResult> selectCheckResult(String modelId,String amosOrgCode);
List<CheckResultDto> selectTotal(String modelId, String amosOrgCode);
}
package com.yeejoin.amos.boot.module.tdc.api.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.module.tdc.api.dto.CheckTotalDto;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckResult;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public interface CheckTotalService extends IService<CheckTotalDto> {
List<CheckTotalDto> selectTotal(String modelId, String amosOrgCode);
}
......@@ -5,4 +5,9 @@
select check_date, case when check_type="1" then '全站校验' else `model_name` end as `name`
from `tdc_check_result` where amos_org_code=#{code} GROUP BY batch_no;
</select>
<select id="selectTotal" resultType="com.yeejoin.amos.boot.module.tdc.api.dto.CheckResultDto">
SELECT count(1) as total, COUNT(CASE WHEN (check_item_result=1) THEN check_item_result END) AS aaa
FROM tdc_check_result WHERE model_id = #{modelId} and amos_org_code = #{amosOrgCode}
</select>
</mapper>
\ No newline at end of file
<?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.boot.module.tdc.api.mapper.CheckTotalMapper">
<select id="selectTotal" resultType="com.yeejoin.amos.boot.module.tdc.api.dto.CheckTotalDto">
SELECT count(1) as total, COUNT(CASE WHEN (check_item_result=1) THEN check_item_result END) AS aaa
FROM tdc_check_result WHERE model_id = #{modelId} and amos_org_code = #{amosOrgCode}
</select>
</mapper>
......@@ -52,4 +52,12 @@ public class CheckResultController extends BaseController {
public ResponseModel<List<CheckResult>> selectCheckResult( String modelId, String amosOrgCode) {
return ResponseHelper.buildResponse(checkResultService.selectCheckResult(modelId,amosOrgCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/selectTotal")
@ApiOperation(httpMethod = "GET", value = "result", notes = "result")
public ResponseModel<List<CheckResultDto>> selectTotal(String modelId, String amosOrgCode) {
return ResponseHelper.buildResponse(checkResultService.selectTotal(modelId, amosOrgCode));
}
}
package com.yeejoin.amos.boot.module.tdc.biz.controller;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.tdc.api.dto.CheckResultDto;
import com.yeejoin.amos.boot.module.tdc.api.dto.CheckTotalDto;
import com.yeejoin.amos.boot.module.tdc.api.service.CheckResultService;
import com.yeejoin.amos.boot.module.tdc.api.service.CheckTotalService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
@RestController
@Api(tags = "校验结果Api")
@RequestMapping(value = "/check")
public class CheckTotalController extends BaseController{
@Autowired
CheckTotalService checkTotalService;
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/selectTotal")
@ApiOperation(httpMethod = "GET", value = "result", notes = "result")
public ResponseModel<List<CheckTotalDto>> selectTotal( String modelId,String amosOrgCode) {
return ResponseHelper.buildResponse(checkTotalService.selectTotal(modelId, amosOrgCode));
}
}
......@@ -34,4 +34,9 @@ public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult>
return baseMapper.selectList(wrapper);
}
@Override
public List<CheckResultDto> selectTotal(String modelId, String amosOrgCode) {
return checkResultMapper.selectTotal(modelId, amosOrgCode);
}
}
package com.yeejoin.amos.boot.module.tdc.biz.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.amos.boot.module.tdc.api.dto.CheckResultDto;
import com.yeejoin.amos.boot.module.tdc.api.dto.CheckTotalDto;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckResult;
import com.yeejoin.amos.boot.module.tdc.api.mapper.CheckTotalMapper;
import com.yeejoin.amos.boot.module.tdc.api.service.CheckResultService;
import com.yeejoin.amos.boot.module.tdc.api.service.CheckTotalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class CheckTotalImpl extends ServiceImpl<CheckTotalMapper, CheckTotalDto> implements CheckTotalService {
@Autowired
CheckTotalMapper checkTotalMapper;
@Override
public List<CheckTotalDto> selectTotal(String modelId, String amosOrgCode) {
return checkTotalMapper.selectTotal(modelId, amosOrgCode);
}
}
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