Commit 8bec46ee authored by 赵啸非's avatar 赵啸非

Merge remote-tracking branch 'origin/master'

parents feaa01fa bb27067f
......@@ -195,9 +195,7 @@ export default {
formatter(row, column, val) {
const content = formatter(this.tableData, column, val);
return content == 0 ? (
<el-tag type={"info"} size="mini">
{content}
</el-tag>
<p>{content}</p>
) : content ? (
content == "未处理" ? (
<el-tag type={"danger"} size="mini">
......@@ -208,17 +206,11 @@ export default {
{content}
</el-tag>
) : row.subAddType == 1 && column.label.includes("分值") ? (
<el-tag type={"info"} size="mini">
{content}
</el-tag>
<p>{content}</p>
) : row.subAddType == 2 && column.label.includes("分值") ? (
<el-tag type={"info"} size="mini">
{-content}
</el-tag>
<p>{-content}</p>
) : (
<el-tag type={"info"} size="mini">
{content}
</el-tag>
<p>{content}</p>
)
) : (
val
......
......@@ -46,7 +46,7 @@ const formatterAmount = (row, column) => {
const formatterDate = (row, column) => {
const property = column.property;
const time = row[property];
if(!time) return '-';
if(!time) return '--';
let date = time.length<13?new Date(Number(time) * 1000) : new Date(Number(time));
let Y = date.getFullYear() + '-';
let M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
......
......@@ -12,7 +12,7 @@
:empty-text="emptytxt ? emptytxt : emptyText"
border
style="width: 100%"
height="520"
height="570"
>
<el-table-column
v-for="column in columns"
......@@ -119,6 +119,14 @@ export default {
? (this.emptytxt = "暂无数据")
: (this.emptytxt = "加载中...");
// if (val.length > 0) {
// val.forEach((v) => {
// for (let key in v) {
// v[key] ? "" : (v[key] = "--");
// }
// });
// console.log(val);
// }
},
},
methods: {},
......
......@@ -218,7 +218,11 @@ export default {
{ label: "绩效规则", prop: "ruleName" },
{ label: "加分/扣分方式", prop: "subMethod", formatter: this.formatter },
{
label: "加分/扣分方式",
prop: "subMethod",
formatter: this.formatter,
},
{
label: "加分/扣分时间",
......@@ -228,6 +232,18 @@ export default {
{ label: "加分/扣分人员", prop: "deductPerson" },
{ label: "核查结果", prop: "checkResult", formatter: this.formatter },
{ label: "说明", prop: "checkDesc" },
{ label: "核查人员", prop: "checkPerson" },
{
label: "核查时间",
prop: "checkTime",
formatter: this.formatterDate,
},
{ label: "分值", prop: "score", formatter: this.formatter },
{
......
......@@ -225,7 +225,11 @@ export default {
{ label: "绩效规则", prop: "ruleNme" },
{ label: "加分/扣分方式", prop: "subMethod", formatter: this.formatter },
{
label: "加分/扣分方式",
prop: "subMethod",
formatter: this.formatter,
},
{
label: "加分/扣分时间",
......@@ -235,6 +239,18 @@ export default {
{ label: "加分/扣分人员", prop: "deductPerson" },
{ label: "核查结果", prop: "checkResult", formatter: this.formatter },
{ label: "说明", prop: "checkDesc" },
{ label: "核查人员", prop: "checkPerson" },
{
label: "核查时间",
prop: "checkTime",
formatter: this.formatterDate,
},
{ label: "分值", prop: "score", formatter: this.formatter },
{
......
......@@ -225,7 +225,11 @@ export default {
{ label: "绩效规则", prop: "ruleName" },
{ label: "加分/扣分方式", prop: "subMethod", formatter: this.formatter },
{
label: "加分/扣分方式",
prop: "subMethod",
formatter: this.formatter,
},
{
label: "加分/扣分时间",
......@@ -235,6 +239,18 @@ export default {
{ label: "加分/扣分人员", prop: "deductPerson" },
{ label: "核查结果", prop: "checkResult", formatter: this.formatter },
{ label: "说明", prop: "checkDesc" },
{ label: "核查人员", prop: "checkPerson" },
{
label: "核查时间",
prop: "checkTime",
formatter: this.formatterDate,
},
{ label: "分值", prop: "score", formatter: this.formatter },
{
......
......@@ -213,7 +213,11 @@ export default {
{ label: "绩效规则", prop: "ruleName" },
{ label: "加分/扣分方式", prop: "subMethod", formatter: this.formatter },
{
label: "加分/扣分方式",
prop: "subMethod",
formatter: this.formatter,
},
{
label: "加分/扣分时间",
......@@ -223,6 +227,18 @@ export default {
{ label: "加分/扣分人员", prop: "deductPerson" },
{ label: "核查结果", prop: "checkResult", formatter: this.formatter },
{ label: "说明", prop: "checkDesc" },
{ label: "核查人员", prop: "checkPerson" },
{
label: "核查时间",
prop: "checkTime",
formatter: this.formatterDate,
},
{ label: "分值", prop: "score", formatter: this.formatter },
{
......
......@@ -221,7 +221,11 @@ export default {
{ label: "绩效规则", prop: "ruleName" },
{ label: "加分/扣分方式", prop: "subMethod", formatter: this.formatter },
{
label: "加分/扣分方式",
prop: "subMethod",
formatter: this.formatter,
},
{
label: "加分/扣分时间",
......@@ -231,6 +235,18 @@ export default {
{ label: "加分/扣分人员", prop: "deductPerson" },
{ label: "核查结果", prop: "checkResult", formatter: this.formatter },
{ label: "说明", prop: "checkDesc" },
{ label: "核查人员", prop: "checkPerson" },
{
label: "核查时间",
prop: "checkTime",
formatter: this.formatterDate,
},
{ label: "分值", prop: "score", formatter: this.formatter },
{
......
......@@ -222,7 +222,11 @@ export default {
{ label: "绩效规则", prop: "ruleNme" },
{ label: "加分/扣分方式", prop: "subMethod", formatter: this.formatter },
{
label: "加分/扣分方式",
prop: "subMethod",
formatter: this.formatter,
},
{
label: "加分/扣分时间",
......@@ -232,6 +236,18 @@ export default {
{ label: "加分/扣分人员", prop: "deductPerson" },
{ label: "核查结果", prop: "checkResult", formatter: this.formatter },
{ label: "说明", prop: "checkDesc" },
{ label: "核查人员", prop: "checkPerson" },
{
label: "核查时间",
prop: "checkTime",
formatter: this.formatterDate,
},
{ label: "分值", prop: "score", formatter: this.formatter },
{
......
......@@ -116,6 +116,8 @@ export default {
{ label: "分类", prop: "categoryId", formatter: this.formatter },
{ label: "考核名称", prop: "name" },
{ label: "考核编码", prop: "ruleCode" },
{ label: "评分标准", prop: "content" },
{ label: "增减类型", prop: "subAddType", formatter: this.formatter },
......
......@@ -4,6 +4,8 @@ import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.xhx.module.check.model.CheckAllRecordQuery;
import com.mortals.xhx.module.check.model.vo.CheckAllRecordVo;
import com.mortals.xhx.module.check.model.vo.CheckAllScoreSummaryVo;
import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryQuery;
import java.util.List;
......@@ -12,5 +14,18 @@ import java.util.List;
*/
public interface CheckAllRecordDao {
/**
* 获取全部绩效核查信息列表
* @param query
* @param pageInfo
* @return
*/
Result<CheckAllRecordVo> getAllCheckRecord(CheckAllRecordQuery query, PageInfo pageInfo);
/**
* 绩效核查分数情况汇总
* @param query
* @return
*/
CheckAllScoreSummaryVo getScoreSummary(StaffCheckSummaryQuery query);
}
......@@ -6,6 +6,8 @@ import com.mortals.framework.model.Result;
import com.mortals.xhx.module.check.dao.CheckAllRecordDao;
import com.mortals.xhx.module.check.model.CheckAllRecordQuery;
import com.mortals.xhx.module.check.model.vo.CheckAllRecordVo;
import com.mortals.xhx.module.check.model.vo.CheckAllScoreSummaryVo;
import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryQuery;
import org.apache.ibatis.session.RowBounds;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.support.SqlSessionDaoSupport;
......@@ -67,7 +69,12 @@ public class CheckAllRecordDaoImpl extends SqlSessionDaoSupport implements Check
return result;
}
public int getCount(CheckAllRecordQuery checkAllRecordQuery) {
private int getCount(CheckAllRecordQuery checkAllRecordQuery) {
return (Integer)this.getSqlSession().selectOne(this.getSqlId("getListCount"), checkAllRecordQuery);
}
@Override
public CheckAllScoreSummaryVo getScoreSummary(StaffCheckSummaryQuery query) {
return this.getSqlSession().selectOne(this.getSqlId("getScoreSummary"), query);
}
}
package com.mortals.xhx.module.check.model.vo;
import lombok.Data;
import java.math.BigDecimal;
/**
* 绩效分值统计
*/
@Data
public class CheckAllScoreSummaryVo {
/**初始扣分*/
private BigDecimal initScore;
/**核查扣分*/
private BigDecimal checkScore;
/**申诉分值*/
private BigDecimal appealScore;
/**累计扣分*/
private BigDecimal total;
}
......@@ -7,7 +7,8 @@ import lombok.Data;
*/
@Data
public class StaffCheckSummaryQuery {
/** 汇总方式 1按年,2按月,3按天*/
private Integer summaryType;
/**员工ID*/
private Long staffId;
/** 开始 核查时间 */
......
......@@ -4,6 +4,8 @@ import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.xhx.module.check.model.CheckAllRecordQuery;
import com.mortals.xhx.module.check.model.vo.CheckAllRecordVo;
import com.mortals.xhx.module.check.model.vo.CheckAllScoreSummaryVo;
import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryQuery;
import java.util.List;
......@@ -12,5 +14,18 @@ import java.util.List;
*/
public interface CheckAllRecordService {
/**
* 获取全部绩效核查信息列表
* @param query
* @param pageInfo
* @return
*/
Result<CheckAllRecordVo> getAllCheckRecord(CheckAllRecordQuery query, PageInfo pageInfo);
/**
* 绩效核查分数情况汇总
* @param query
* @return
*/
CheckAllScoreSummaryVo getScoreSummary(StaffCheckSummaryQuery query);
}
......@@ -2,11 +2,16 @@ package com.mortals.xhx.module.check.service.impl;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.common.code.SummaryTopTypeEnum;
import com.mortals.xhx.module.check.dao.CheckAllRecordDao;
import com.mortals.xhx.module.check.model.CheckAllRecordQuery;
import com.mortals.xhx.module.check.model.vo.CheckAllRecordVo;
import com.mortals.xhx.module.check.model.vo.CheckAllScoreSummaryVo;
import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryQuery;
import com.mortals.xhx.module.check.service.CheckAllRecordService;
import com.mortals.xhx.module.dept.model.vo.DeptSummaryTopQuery;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -36,4 +41,9 @@ public class CheckAllRecordServiceImpl implements CheckAllRecordService {
}
return checkAllRecordDao.getAllCheckRecord(query,pageInfo);
}
@Override
public CheckAllScoreSummaryVo getScoreSummary(StaffCheckSummaryQuery query) {
return checkAllRecordDao.getScoreSummary(query);
}
}
package com.mortals.xhx.module.check.web;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.util.DataUtil;
import com.mortals.framework.util.DateUtils;
import com.mortals.framework.web.BaseJsonBodyController;
import com.mortals.xhx.common.code.CheckStatusEnum;
import com.mortals.xhx.common.code.CheckTypeEnum;
import com.mortals.xhx.common.code.SubAddTypeEnum;
import com.mortals.xhx.common.code.SubMethodEnum;
import com.mortals.xhx.common.code.*;
import com.mortals.xhx.module.check.model.CheckAllRecordQuery;
import com.mortals.xhx.module.check.model.vo.CheckAllRecordVo;
import com.mortals.xhx.module.check.model.vo.CheckAllScoreSummaryVo;
import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryQuery;
import com.mortals.xhx.module.check.service.CheckAllRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
......@@ -20,6 +22,12 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.text.NumberFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -72,4 +80,130 @@ public class CheckAllRecordController extends BaseJsonBodyController {
ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
return ret;
}
/**
* 绩效核查分数情况汇总
* @param query
* @return
*/
@PostMapping({"score/summary"})
@UnAuth
public Rest<Object> getScoreSummary(@RequestBody StaffCheckSummaryQuery query) {
Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap();
Context context = this.getContext();
String busiDesc = "查询绩效核查分数情况汇总";
int code=1;
try {
StaffCheckSummaryQuery lastQuery = new StaffCheckSummaryQuery();
Date now = new Date();
LocalDate localDate = LocalDate.now();
if (query.getSummaryType() == SummaryTopTypeEnum..getValue()) {
query.setCheckTimeStart(DateUtils.getCurrDateTime("yyyy")+"-01-01");
query.setCheckTimeEnd(DateUtils.getCurrDateTime("yyyy")+"-12-31");
lastQuery.setCheckTimeStart((localDate.getYear()-1)+"-01-01");
lastQuery.setCheckTimeEnd((localDate.getYear()-1)+"-12-31");
}
if (query.getSummaryType() == SummaryTopTypeEnum..getValue()) {
query.setCheckTimeStart(DateUtils.getCurrDateTime("yyyy-MM")+"-01");
query.setCheckTimeEnd(DateUtils.getDateTime(DateUtils.getMonthLastDate(now,"yyyy-MM-dd"),"yyyy-MM-dd"));
lastQuery.setCheckTimeStart(DateUtils.getDateTime(DateUtils.getLastMonthFirstDate(now,"yyyy-MM-dd"),"yyyy-MM-dd"));
lastQuery.setCheckTimeEnd(DateUtils.getDateTime(DateUtils.getLastMonthLastDate(now,"yyyy-MM-dd"),"yyyy-MM-dd"));
}
if (query.getSummaryType() == SummaryTopTypeEnum..getValue()) {
query.setCheckTimeStart(DateUtils.getCurrStrDate());
query.setCheckTimeEnd(DateUtils.getCurrStrDate());
lastQuery.setCheckTimeStart(DateUtils.getDateTime(DateUtils.addDate(now,-1),"yyyy-MM-dd"));
lastQuery.setCheckTimeEnd(DateUtils.getDateTime(DateUtils.addDate(now,-1),"yyyy-MM-dd"));
}
model.put("initScore",0);
model.put("checkScore",0);
model.put("checkPercent","0%");
model.put("appealPercent","0%");
model.put("appealScore",0);
model.put("total",0);
model.put("huanbi","暂无环比");
model.put("tongbi","暂无同比");
CheckAllScoreSummaryVo current = checkAllRecordService.getScoreSummary(query);
NumberFormat numberFormat = NumberFormat.getPercentInstance();
numberFormat.setMaximumFractionDigits(2);
if(current!=null){
model.put("initScore",current.getInitScore());
model.put("checkScore",current.getCheckScore());
model.put("appealScore",current.getAppealScore());
model.put("total",current.getTotal());
BigDecimal checkPercent = current.getCheckScore().divide(current.getInitScore(),6,BigDecimal.ROUND_HALF_UP);
model.put("checkPercent",numberFormat.format(checkPercent));
BigDecimal appealPercent = current.getAppealScore().divide(current.getInitScore(),6,BigDecimal.ROUND_HALF_UP);
model.put("appealPercent",numberFormat.format(appealPercent));
}
CheckAllScoreSummaryVo last = checkAllRecordService.getScoreSummary(lastQuery);
if(last!=null){
BigDecimal huanbi = current.getTotal().subtract(last.getTotal());
huanbi = huanbi.divide(last.getTotal(),6,BigDecimal.ROUND_HALF_UP);
model.put("huanbi",numberFormat.format(huanbi));
}
if (query.getSummaryType() == SummaryTopTypeEnum..getValue()) {
if(last!=null){
model.put("tongbi",model.get("huanbi"));
}
}else {
String yyyy = query.getCheckTimeStart().substring(0,4);
int lastyear = DataUtil.converStr2Int(yyyy,0);
lastyear--;
if(query.getCheckTimeStart().substring(4).equals("-02-29")){
lastQuery.setCheckTimeStart(lastyear+"-02-28");
}else {
lastQuery.setCheckTimeStart(lastyear+query.getCheckTimeStart().substring(4));
}
if(query.getCheckTimeEnd().substring(4).equals("-02-29")){
lastQuery.setCheckTimeEnd(lastyear+"-02-28");
}else {
lastQuery.setCheckTimeEnd(lastyear+query.getCheckTimeEnd().substring(4));
}
CheckAllScoreSummaryVo tb = checkAllRecordService.getScoreSummary(lastQuery);
if(tb!=null){
BigDecimal tongbi = current.getTotal().subtract(tb.getTotal());
tongbi = tongbi.divide(last.getTotal(),6,BigDecimal.ROUND_HALF_UP);
model.put("tongbi",numberFormat.format(tongbi));
}
}
model.put("message_info", busiDesc + "成功");
if (!ObjectUtils.isEmpty(context) && !ObjectUtils.isEmpty(context.getUser())) {
this.recordSysLog(this.request, busiDesc + " 【成功】");
}
} catch (Exception var9) {
code = -1;
this.doException(this.request, busiDesc, model, var9);
}
ret.setCode(code);
ret.setData(model);
ret.setDict(model.get("dict"));
ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
return ret;
}
public static void main(String[] args){
StaffCheckSummaryQuery query = new StaffCheckSummaryQuery();
query.setCheckTimeStart("2023-02-01");
query.setCheckTimeEnd("2023-02-29");
StaffCheckSummaryQuery lastQuery = new StaffCheckSummaryQuery();
String yyyy = query.getCheckTimeStart().substring(0,4);
String mmdd = query.getCheckTimeStart().substring(4);
int lastyear = DataUtil.converStr2Int(yyyy,0);
lastyear--;
if(query.getCheckTimeStart().substring(4).equals("-02-29")){
lastQuery.setCheckTimeStart(lastyear+"-02-28");
}else {
lastQuery.setCheckTimeStart(lastyear+query.getCheckTimeStart().substring(4));
}
if(query.getCheckTimeEnd().substring(4).equals("-02-29")){
lastQuery.setCheckTimeEnd(lastyear+"-02-28");
}else {
lastQuery.setCheckTimeEnd(lastyear+query.getCheckTimeEnd().substring(4));
}
System.out.println(JSONObject.toJSON(lastQuery).toString());
}
}
......@@ -118,4 +118,55 @@
<if test="createUserId != null and createUserId!=''"> AND createUserId = #{createUserId} </if>
) AS a
</select>
<select id="getScoreSummary" parameterType="com.mortals.xhx.module.check.model.vo.StaffCheckSummaryQuery" resultType="com.mortals.xhx.module.check.model.vo.CheckAllScoreSummaryVo">
SELECT sum(0-a.initScore) AS initScore,sum(0-a.checkScore) AS checkScore,sum(a.appealScore) AS appealScore,sum(0-a.checkScore-a.appealScore) AS total FROM (
SELECT sum(CASE subMethod WHEN 4 THEN 0 ELSE (CASE subAddType WHEN 1 THEN score ELSE score*-1 END) END) as initScore,
sum(CASE checkStatus WHEN 2 THEN (CASE subMethod WHEN 4 THEN 0 ELSE (CASE subAddType WHEN 1 THEN score ELSE score*-1 END) END) ELSE 0 END) checkScore,
sum(CASE checkStatus WHEN 2 THEN (CASE subMethod WHEN 4 THEN (CASE subAddType WHEN 1 THEN score ELSE score*-1 END) ELSE 0 END) ELSE 0 END) appealScore
FROM mortals_xhx_check_attend_record WHERE 1=1
<if test="checkTimeStart != null and checkTimeStart!=''"> AND checkTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{checkTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if>
<if test="checkTimeEnd != null and checkTimeEnd!=''"> AND checkTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{checkTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if>
UNION
SELECT sum(CASE subMethod WHEN 4 THEN 0 ELSE (CASE subAddType WHEN 1 THEN score ELSE score*-1 END) END) as initScore,
sum(CASE checkStatus WHEN 2 THEN (CASE subMethod WHEN 4 THEN 0 ELSE (CASE subAddType WHEN 1 THEN score ELSE score*-1 END) END) ELSE 0 END) checkScore,
sum(CASE checkStatus WHEN 2 THEN (CASE subMethod WHEN 4 THEN (CASE subAddType WHEN 1 THEN score ELSE score*-1 END) ELSE 0 END) ELSE 0 END) appealScore
FROM mortals_xhx_check_effect_record WHERE 1=1
<if test="checkTimeStart != null and checkTimeStart!=''"> AND checkTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{checkTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if>
<if test="checkTimeEnd != null and checkTimeEnd!=''"> AND checkTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{checkTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if>
UNION
SELECT sum(CASE subMethod WHEN 4 THEN 0 ELSE (CASE subAddType WHEN 1 THEN score ELSE score*-1 END) END) as initScore,
sum(CASE checkStatus WHEN 2 THEN (CASE subMethod WHEN 4 THEN 0 ELSE (CASE subAddType WHEN 1 THEN score ELSE score*-1 END) END) ELSE 0 END) checkScore,
sum(CASE checkStatus WHEN 2 THEN (CASE subMethod WHEN 4 THEN (CASE subAddType WHEN 1 THEN score ELSE score*-1 END) ELSE 0 END) ELSE 0 END) appealScore
FROM mortals_xhx_check_complain_record WHERE 1=1
<if test="checkTimeStart != null and checkTimeStart!=''"> AND checkTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{checkTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if>
<if test="checkTimeEnd != null and checkTimeEnd!=''"> AND checkTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{checkTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if>
UNION
SELECT sum(CASE subMethod WHEN 4 THEN 0 ELSE (CASE subAddType WHEN 1 THEN score ELSE score*-1 END) END) as initScore,
sum(CASE checkStatus WHEN 2 THEN (CASE subMethod WHEN 4 THEN 0 ELSE (CASE subAddType WHEN 1 THEN score ELSE score*-1 END) END) ELSE 0 END) checkScore,
sum(CASE checkStatus WHEN 2 THEN (CASE subMethod WHEN 4 THEN (CASE subAddType WHEN 1 THEN score ELSE score*-1 END) ELSE 0 END) ELSE 0 END) appealScore
FROM mortals_xhx_check_gowork_record WHERE 1=1
<if test="checkTimeStart != null and checkTimeStart!=''"> AND checkTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{checkTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if>
<if test="checkTimeEnd != null and checkTimeEnd!=''"> AND checkTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{checkTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if>
UNION
SELECT sum(CASE subMethod WHEN 4 THEN 0 ELSE (CASE subAddType WHEN 1 THEN score ELSE score*-1 END) END) as initScore,
sum(CASE checkStatus WHEN 2 THEN (CASE subMethod WHEN 4 THEN 0 ELSE (CASE subAddType WHEN 1 THEN score ELSE score*-1 END) END) ELSE 0 END) checkScore,
sum(CASE checkStatus WHEN 2 THEN (CASE subMethod WHEN 4 THEN (CASE subAddType WHEN 1 THEN score ELSE score*-1 END) ELSE 0 END) ELSE 0 END) appealScore
FROM mortals_xhx_check_review_record WHERE 1=1
<if test="checkTimeStart != null and checkTimeStart!=''"> AND checkTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{checkTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if>
<if test="checkTimeEnd != null and checkTimeEnd!=''"> AND checkTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{checkTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if>
UNION
SELECT sum(CASE subMethod WHEN 4 THEN 0 ELSE (CASE subAddType WHEN 1 THEN score ELSE score*-1 END) END) as initScore,
sum(CASE checkStatus WHEN 2 THEN (CASE subMethod WHEN 4 THEN 0 ELSE (CASE subAddType WHEN 1 THEN score ELSE score*-1 END) END) ELSE 0 END) checkScore,
sum(CASE checkStatus WHEN 2 THEN (CASE subMethod WHEN 4 THEN (CASE subAddType WHEN 1 THEN score ELSE score*-1 END) ELSE 0 END) ELSE 0 END) appealScore
FROM mortals_xhx_check_other_record WHERE 1=1
<if test="checkTimeStart != null and checkTimeStart!=''"> AND checkTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{checkTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if>
<if test="checkTimeEnd != null and checkTimeEnd!=''"> AND checkTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{checkTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if>
) AS a
</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