Commit 5c639228 authored by 温志超's avatar 温志超

更新报表

parent ccb3425e
...@@ -35,39 +35,39 @@ public class MonthlyProductionReportController { ...@@ -35,39 +35,39 @@ public class MonthlyProductionReportController {
@ApiOperation("产能对比统计:统计方式车间") @ApiOperation("产能对比统计:统计方式车间")
@PreAuthorize("@ss.hasPermi('mes:pro:dailyProductionReport:get')") @PreAuthorize("@ss.hasPermi('mes:pro:dailyProductionReport:get')")
@Log(title = "产能对比统计:统计方式车间", businessType = BusinessType.QUERY) @Log(title = "产能对比统计:统计方式车间", businessType = BusinessType.QUERY)
@GetMapping("/getListByWorkshop") @GetMapping("/getListByWorkshop")
public AjaxResult<List> getListByWorkshop(MonthlyProductionReportRequest dailyProductionReportRequest) { public AjaxResult<List> getListByWorkshop(MonthlyProductionReportRequest monthlyProductionReportRequest) {
List data = monthlyProductionReportService.getListByWorkshop(dailyProductionReportRequest); List data = monthlyProductionReportService.getListByWorkshop(monthlyProductionReportRequest);
return AjaxResult.success(data); return AjaxResult.success(data);
} }
@ApiOperation("产能对比统计:统计方式工作中心") @ApiOperation("产能对比统计:统计方式工作中心")
@PreAuthorize("@ss.hasPermi('mes:pro:dailyProductionReport:get')") @PreAuthorize("@ss.hasPermi('mes:pro:dailyProductionReport:get')")
@Log(title = "产能对比统计:统计方式工作中心", businessType = BusinessType.QUERY) @Log(title = "产能对比统计:统计方式工作中心", businessType = BusinessType.QUERY)
@GetMapping("/getListByWorkstation") @GetMapping("/getListByWorkstation")
public AjaxResult<List> getListByWorkstation(MonthlyProductionReportRequest dailyProductionReportRequest) { public AjaxResult<List> getListByWorkstation(MonthlyProductionReportRequest monthlyProductionReportRequest) {
List data = monthlyProductionReportService.getListByWorkstation(dailyProductionReportRequest); List data = monthlyProductionReportService.getListByWorkstation(monthlyProductionReportRequest);
return AjaxResult.success(data); return AjaxResult.success(data);
} }
@ApiOperation("产能对比统计:统计方式工作单元") @ApiOperation("产能对比统计:统计方式工作单元")
@PreAuthorize("@ss.hasPermi('mes:pro:dailyProductionReport:get')") @PreAuthorize("@ss.hasPermi('mes:pro:dailyProductionReport:get')")
@Log(title = "产能对比统计:统计方式工作单元", businessType = BusinessType.QUERY) @Log(title = "产能对比统计:统计方式工作单元", businessType = BusinessType.QUERY)
@GetMapping("/getListByWorkunit") @GetMapping("/getListByWorkunit")
public AjaxResult<List> getListByWorkunit(MonthlyProductionReportRequest dailyProductionReportRequest) { public AjaxResult<List> getListByWorkunit(MonthlyProductionReportRequest monthlyProductionReportRequest) {
List data = monthlyProductionReportService.getListByWorkunit(dailyProductionReportRequest); List data = monthlyProductionReportService.getListByWorkunit(monthlyProductionReportRequest);
return AjaxResult.success(data); return AjaxResult.success(data);
} }
@ApiOperation("产能对比统计:统计方式报工人员") @ApiOperation("产能对比统计:统计方式报工人员")
@PreAuthorize("@ss.hasPermi('mes:pro:dailyProductionReport:get')") @PreAuthorize("@ss.hasPermi('mes:pro:dailyProductionReport:get')")
@Log(title = "产能对比统计:统计方式报工人员", businessType = BusinessType.QUERY) @Log(title = "产能对比统计:统计方式报工人员", businessType = BusinessType.QUERY)
@GetMapping("/getListByUser") @GetMapping("/getListByUser")
public AjaxResult<List> getListByUser(MonthlyProductionReportRequest dailyProductionReportRequest) { public AjaxResult<List> getListByUser(MonthlyProductionReportRequest monthlyProductionReportRequest) {
List data = monthlyProductionReportService.getListByUser(dailyProductionReportRequest); List data = monthlyProductionReportService.getListByUser(monthlyProductionReportRequest);
return AjaxResult.success(data); return AjaxResult.success(data);
} }
......
package com.ximai.mes.report.controller; package com.ximai.mes.report.controller;
import com.ximai.common.annotation.Log;
import com.ximai.common.core.domain.AjaxResult;
import com.ximai.common.enums.BusinessType;
import com.ximai.mes.report.request.WeeklyProductionReportRequest;
import com.ximai.mes.report.service.MonthlyProductionReportService;
import com.ximai.mes.report.service.WeeklyProductionReportService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Api("周产能对比统计") @Api("周产能对比统计")
@RestController @RestController
@RequestMapping("/weeklyProductionReport") @RequestMapping("/weeklyProductionReport")
public class WeeklyProductionReportController { public class WeeklyProductionReportController {
@Autowired
WeeklyProductionReportService weeklyProductionReportService;
@ApiOperation("周产能对比统计:统计方式工序")
@PreAuthorize("@ss.hasPermi('mes:pro:dailyProductionReport:get')")
@Log(title = "周产能对比统计:统计方式工序", businessType = BusinessType.QUERY)
@GetMapping("/getListByProcess")
public AjaxResult<List> getListByProcess(WeeklyProductionReportRequest weeklyProductionReportRequest) {
List data = weeklyProductionReportService.getListByProcess(weeklyProductionReportRequest);
return AjaxResult.success(data);
}
@ApiOperation("周产能对比统计:统计方式车间")
@PreAuthorize("@ss.hasPermi('mes:pro:dailyProductionReport:get')")
@Log(title = "周产能对比统计:统计方式车间", businessType = BusinessType.QUERY)
@GetMapping("/getListByWorkshop")
public AjaxResult<List> getListByWorkshop(WeeklyProductionReportRequest weeklyProductionReportRequest) {
List data = weeklyProductionReportService.getListByWorkshop(weeklyProductionReportRequest);
return AjaxResult.success(data);
}
@ApiOperation("周产能对比统计:统计方式工作中心")
@PreAuthorize("@ss.hasPermi('mes:pro:dailyProductionReport:get')")
@Log(title = "周产能对比统计:统计方式工作中心", businessType = BusinessType.QUERY)
@GetMapping("/getListByWorkstation")
public AjaxResult<List> getListByWorkstation(WeeklyProductionReportRequest weeklyProductionReportRequest) {
List data = weeklyProductionReportService.getListByWorkstation(weeklyProductionReportRequest);
return AjaxResult.success(data);
}
@ApiOperation("周产能对比统计:统计方式工作单元")
@PreAuthorize("@ss.hasPermi('mes:pro:dailyProductionReport:get')")
@Log(title = "周产能对比统计:统计方式工作单元", businessType = BusinessType.QUERY)
@GetMapping("/getListByWorkunit")
public AjaxResult<List> getListByWorkunit(WeeklyProductionReportRequest weeklyProductionReportRequest) {
List data = weeklyProductionReportService.getListByWorkunit(weeklyProductionReportRequest);
return AjaxResult.success(data);
}
@ApiOperation("周产能对比统计:统计方式报工人员")
@PreAuthorize("@ss.hasPermi('mes:pro:dailyProductionReport:get')")
@Log(title = "周产能对比统计:统计方式报工人员", businessType = BusinessType.QUERY)
@GetMapping("/getListByUser")
public AjaxResult<List> getListByUser(WeeklyProductionReportRequest weeklyProductionReportRequest) {
List data = weeklyProductionReportService.getListByUser(weeklyProductionReportRequest);
return AjaxResult.success(data);
}
} }
package com.ximai.mes.report.mapper; package com.ximai.mes.report.mapper;
import com.ximai.mes.report.request.WeeklyProductionReportRequest;
import java.util.List;
import java.util.Map;
public interface WeeklyProductionReportMapper { public interface WeeklyProductionReportMapper {
List<Map> getListByProcess(WeeklyProductionReportRequest weeklyProductionReportRequest);
List<Map> getListByWorkshop(WeeklyProductionReportRequest weeklyProductionReportRequest);
List<Map> getListByWorkstation(WeeklyProductionReportRequest weeklyProductionReportRequest);
List<Map> getListByWorkunit(WeeklyProductionReportRequest weeklyProductionReportRequest);
List<Map> getListByUser(WeeklyProductionReportRequest weeklyProductionReportRequest);
} }
...@@ -7,7 +7,7 @@ import lombok.Data; ...@@ -7,7 +7,7 @@ import lombok.Data;
import java.util.Date; import java.util.Date;
@Data @Data
public class MonthlyProductionReportRequest { public class MonthlyProductionReportRequest {
@ApiModelProperty("年份") @ApiModelProperty("年份 比如: 2024")
private String dateYear; private String dateYear;
/** /**
......
package com.ximai.mes.report.request; package com.ximai.mes.report.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@Data @Data
public class WeeklyProductionReportRequest { public class WeeklyProductionReportRequest {
@ApiModelProperty("年月份 比如:2024-01")
private String dateWeekly;
/**
* 工序ID
*/
@ApiModelProperty( "工序ID")
private Long processId;
/**
* 工序编码
*/
@ApiModelProperty( "工序编码")
private String processCode;
/**
* 工序编码
*/
@ApiModelProperty( "工序名称")
private String processName;
/**
* 车间ID
*/
@ApiModelProperty("车间ID")
private Long workshopId;
@ApiModelProperty("车间名称")
private String workshopName;
/**
* 工作中心ID
*/
@ApiModelProperty( "工作中心ID")
private Long workstationId;
/**
* 工作中心名称
*/
@ApiModelProperty( "工作中心名称")
private String workstationName;
/**
*
*/
@ApiModelProperty("工作单元ID")
private Long workunitId;
@ApiModelProperty("作业单元名称")
private String workunitName;
@ApiModelProperty("报工人员名称")
private String userName;
@ApiModelProperty("报工人员昵称")
private String nickName;
} }
package com.ximai.mes.report.service; package com.ximai.mes.report.service;
import com.ximai.mes.report.request.WeeklyProductionReportRequest;
import java.util.List;
public interface WeeklyProductionReportService { public interface WeeklyProductionReportService {
List getListByProcess(WeeklyProductionReportRequest weeklyProductionReportRequest);
List getListByWorkshop(WeeklyProductionReportRequest weeklyProductionReportRequest);
List getListByWorkstation(WeeklyProductionReportRequest weeklyProductionReportRequest);
List getListByWorkunit(WeeklyProductionReportRequest weeklyProductionReportRequest);
List getListByUser(WeeklyProductionReportRequest weeklyProductionReportRequest);
} }
package com.ximai.mes.report.service.impl; package com.ximai.mes.report.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.ximai.common.utils.data.ExceptionUtil;
import com.ximai.mes.report.mapper.MonthlyProductionReportMapper;
import com.ximai.mes.report.mapper.WeeklyProductionReportMapper;
import com.ximai.mes.report.request.WeeklyProductionReportRequest;
import com.ximai.mes.report.service.WeeklyProductionReportService; import com.ximai.mes.report.service.WeeklyProductionReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.temporal.TemporalAdjusters;
import java.util.*;
@Service
public class WeeklyProductionReportServiceImp implements WeeklyProductionReportService { public class WeeklyProductionReportServiceImp implements WeeklyProductionReportService {
// private List<String> dateList =new ArrayList<String>(
// Arrays.asList( "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"));
@Autowired
DailyProductionReportServiceImp dailyProductionReportServiceImp;
@Autowired
WeeklyProductionReportMapper weeklyProductionReportMapper;
@Override
public List getListByProcess(WeeklyProductionReportRequest weeklyProductionReportRequest) {
ExceptionUtil.checkTrueThrowException(weeklyProductionReportRequest.getDateWeekly() == null,
"请传入年月份");
List<Map> processDataList = weeklyProductionReportMapper.getListByProcess(weeklyProductionReportRequest);
List<String> dateList = getWeeks(new Integer(weeklyProductionReportRequest.getDateWeekly().split("-")[0]), new Integer(weeklyProductionReportRequest.getDateWeekly().split("-")[1]));
List<Map> returnList = dailyProductionReportServiceImp.groupList(processDataList,"工序名称","工序编码","工序",dateList);
return returnList;
}
@Override
public List getListByWorkshop(WeeklyProductionReportRequest weeklyProductionReportRequest) {
ExceptionUtil.checkTrueThrowException(weeklyProductionReportRequest.getDateWeekly() == null,
"请传入年月份");
List<Map> processDataList = weeklyProductionReportMapper.getListByWorkshop(weeklyProductionReportRequest);
List<String> dateList = getWeeks(new Integer(weeklyProductionReportRequest.getDateWeekly().split("-")[0]), new Integer(weeklyProductionReportRequest.getDateWeekly().split("-")[1]));
List<Map> returnList = dailyProductionReportServiceImp.groupList(processDataList,"车间名称","车间编码","车间",dateList);
return returnList;
}
@Override
public List getListByWorkstation(WeeklyProductionReportRequest weeklyProductionReportRequest) {
ExceptionUtil.checkTrueThrowException(weeklyProductionReportRequest.getDateWeekly() == null,
"请传入年月份");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
List<Map> processDataList = weeklyProductionReportMapper.getListByWorkstation(weeklyProductionReportRequest);
List<String> dateList = getWeeks(new Integer(weeklyProductionReportRequest.getDateWeekly().split("-")[0]), new Integer(weeklyProductionReportRequest.getDateWeekly().split("-")[1]));
List<Map> returnList = dailyProductionReportServiceImp.groupList(processDataList,"工作中心名称","工作中心编码","工作中心",dateList);
return returnList;
}
@Override
public List getListByWorkunit(WeeklyProductionReportRequest weeklyProductionReportRequest) {
ExceptionUtil.checkTrueThrowException(weeklyProductionReportRequest.getDateWeekly() == null,
"请传入年月份");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
List<Map> processDataList = weeklyProductionReportMapper.getListByWorkunit(weeklyProductionReportRequest);
List<String> dateList = getWeeks(new Integer(weeklyProductionReportRequest.getDateWeekly().split("-")[0]), new Integer(weeklyProductionReportRequest.getDateWeekly().split("-")[1]));
List<Map> returnList = dailyProductionReportServiceImp.groupList(processDataList,"工作单元名称","工作单元编码","工作单元",dateList);
return returnList;
}
@Override
public List getListByUser(WeeklyProductionReportRequest weeklyProductionReportRequest) {
ExceptionUtil.checkTrueThrowException(weeklyProductionReportRequest.getDateWeekly() == null,
"请传入年月份");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
List<Map> processDataList = weeklyProductionReportMapper.getListByUser(weeklyProductionReportRequest);
List<String> dateList = getWeeks(new Integer(weeklyProductionReportRequest.getDateWeekly().split("-")[0]), new Integer(weeklyProductionReportRequest.getDateWeekly().split("-")[1]));
List<Map> returnList = dailyProductionReportServiceImp.groupList(processDataList,"报工人员名称","报工人员编码","报工人员",dateList);
return returnList;
}
public static List<String> getWeeksInMonth(String dateWeekly) {
dateWeekly = dateWeekly + "-01";
LocalDate date = LocalDate.parse(dateWeekly);
LocalDate firstDayOfMonth = date.with(TemporalAdjusters.firstDayOfMonth());
LocalDate firstDayOfNextMonth = date.with(TemporalAdjusters.firstDayOfNextMonth());
LocalDate lastDayOfMonth = firstDayOfNextMonth.minusDays(1);
// 如果月份的第一个星期一之前有足够的天数构成一周,则总周数加一
if (firstDayOfMonth.getDayOfWeek().getValue() <= firstDayOfMonth.getDayOfMonth()) {
List<String> data = new ArrayList<>();
int x = (int) ((lastDayOfMonth.getDayOfMonth() - firstDayOfMonth.getDayOfMonth()) / 7) + 1;
for (int i = 1 ; i <= x ; i ++){
data.add(""+i);
}
return data;
} else {
int x = (int) ((lastDayOfMonth.getDayOfMonth() - firstDayOfMonth.getDayOfMonth()) / 7);
List<String> data = new ArrayList<>();
for (int i = 1 ; i <= x ; i ++){
data.add(""+i);
}
return data;
}
}
private List<String> getWeeks(Integer year, Integer month) {
//天数
Calendar c = Calendar.getInstance();
c.set(Calendar.YEAR, year);
c.set(Calendar.MONTH, month -1);
System.out.println("天数:" + c.getActualMaximum(Calendar.DAY_OF_MONTH));
int days = c.getActualMaximum(Calendar.DAY_OF_MONTH);
//月起止时间
DateTime startTime = null;
try {
startTime = DateUtil.beginOfMonth(new SimpleDateFormat("yyyy-MM").parse(year +"-"+ month));
} catch (ParseException e) {
throw new RuntimeException(e);
}
int i = DateUtil.dayOfWeek(startTime);
int firstWeek = 0;
switch (i){
case 1 :
firstWeek = 1;
break;
case 2 :
firstWeek = 7;
break;
case 3 :
firstWeek = 6;
break;
case 4 :
firstWeek = 5;
break;
case 5 :
firstWeek = 4;
break;
case 6 :
firstWeek = 3;
break;
case 7 :
firstWeek = 2;
break;
}
int remainingDays = days - firstWeek;
int weeks = (int)Math.ceil((double)remainingDays/7) + 1;
List<String> data = new ArrayList<>();
for (int x = 1 ; x <= weeks ; x ++){
data.add(""+x);
}
return data;
}
} }
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
SELECT SELECT
process.process_code AS "工序编码", process.process_code AS "工序编码",
process.process_name AS "工序名称", process.process_name AS "工序名称",
DATE_FORMAT( f.feedback_time, '%m' ) AS "报工日期", CAST( WEEK ( f.feedback_time, 1 ) - WEEK ( DATE_FORMAT( f.feedback_time, '%Y-%m-01' ), 1 ) + 1 AS CHAR) AS "报工日期",
sum( f.quantity ) AS quantity, sum( f.quantity ) AS quantity,
sum( f.quantity_qualify ) AS '合格数量', sum( f.quantity_qualify ) AS '合格数量',
sum( f.quantity_unqualify ) AS '不合格数量', sum( f.quantity_unqualify ) AS '不合格数量',
...@@ -20,18 +20,18 @@ ...@@ -20,18 +20,18 @@
<where> <where>
<if test=" processId != null ">and process.process_id = #{processId}</if> <if test=" processId != null ">and process.process_id = #{processId}</if>
<if test=" processName != null and processName != '' ">and process.process_name like '%${processName}%'</if> <if test=" processName != null and processName != '' ">and process.process_name like '%${processName}%'</if>
<if test="dateYear != null">and DATE_FORMAT(f.feedback_time, '%Y') = #{dateYear}</if> <if test="dateWeekly != null">and DATE_FORMAT(f.feedback_time, '%Y-%m') = #{dateWeekly}</if>
</where> </where>
GROUP BY GROUP BY
process.process_code, process.process_code,
process.process_name, process.process_name,
DATE_FORMAT( f.feedback_time, '%m' ) CAST( WEEK ( f.feedback_time, 1 ) - WEEK ( DATE_FORMAT( f.feedback_time, '%Y-%m-01' ), 1 ) + 1 AS CHAR)
</select> </select>
<select id="getListByWorkshop" resultType="java.util.Map"> <select id="getListByWorkshop" resultType="java.util.Map">
SELECT SELECT
workstation.workshop_code as '车间编码', workstation.workshop_code as '车间编码',
workstation.workshop_name as '车间名称', workstation.workshop_name as '车间名称',
DATE_FORMAT( f.feedback_time, '%m' ) AS "报工日期", CAST( WEEK ( f.feedback_time, 1 ) - WEEK ( DATE_FORMAT( f.feedback_time, '%Y-%m-01' ), 1 ) + 1 AS CHAR) AS "报工日期",
sum( f.quantity ) AS quantity, sum( f.quantity ) AS quantity,
sum( f.quantity_qualify ) AS '合格数量', sum( f.quantity_qualify ) AS '合格数量',
sum( f.quantity_unqualify ) AS '不合格数量', sum( f.quantity_unqualify ) AS '不合格数量',
...@@ -48,18 +48,18 @@ ...@@ -48,18 +48,18 @@
<where> <where>
<if test=" workshopId != null">and workstation.workshop_Id = #{workshopId}</if> <if test=" workshopId != null">and workstation.workshop_Id = #{workshopId}</if>
<if test=" workshopName != null and workshopName != '' ">and workstation.workshop_name like '%${workshopName}%'</if> <if test=" workshopName != null and workshopName != '' ">and workstation.workshop_name like '%${workshopName}%'</if>
<if test="dateYear != null">and DATE_FORMAT(f.feedback_time, '%Y') = #{dateYear}</if> <if test="dateWeekly != null">and DATE_FORMAT(f.feedback_time, '%Y-%m') = #{dateWeekly}</if>
</where> </where>
group by group by
workstation.workshop_code, workstation.workshop_code,
workstation.workshop_name, workstation.workshop_name,
DATE_FORMAT( f.feedback_time, '%m' ) CAST( WEEK ( f.feedback_time, 1 ) - WEEK ( DATE_FORMAT( f.feedback_time, '%Y-%m-01' ), 1 ) + 1 AS CHAR)
</select> </select>
<select id="getListByWorkstation" resultType="java.util.Map"> <select id="getListByWorkstation" resultType="java.util.Map">
SELECT SELECT
workstation.workstation_code AS "工作中心编码", workstation.workstation_code AS "工作中心编码",
workstation.workstation_name AS "工作中心名称", workstation.workstation_name AS "工作中心名称",
DATE_FORMAT( f.feedback_time, '%m' ) AS "报工日期", CAST( WEEK ( f.feedback_time, 1 ) - WEEK ( DATE_FORMAT( f.feedback_time, '%Y-%m-01' ), 1 ) + 1 AS CHAR) AS "报工日期",
sum( f.quantity ) AS quantity, sum( f.quantity ) AS quantity,
sum( f.quantity_qualify ) AS '合格数量', sum( f.quantity_qualify ) AS '合格数量',
sum( f.quantity_unqualify ) AS '不合格数量', sum( f.quantity_unqualify ) AS '不合格数量',
...@@ -76,18 +76,18 @@ ...@@ -76,18 +76,18 @@
<where> <where>
<if test=" workstationId != null">and workstation.workstation_id = #{workstationId} </if> <if test=" workstationId != null">and workstation.workstation_id = #{workstationId} </if>
<if test=" workstationName != null and workstationName != '' ">and workstation.workstation_name like '%${workstationName}%'</if> <if test=" workstationName != null and workstationName != '' ">and workstation.workstation_name like '%${workstationName}%'</if>
<if test="dateYear != null">and DATE_FORMAT(f.feedback_time, '%Y') = #{dateYear}</if> <if test="dateWeekly != null">and DATE_FORMAT(f.feedback_time, '%Y-%m') = #{dateWeekly}</if>
</where> </where>
group by group by
workstation.workstation_code, workstation.workstation_code,
workstation.workstation_name, workstation.workstation_name,
DATE_FORMAT( f.feedback_time, '%m' ) CAST( WEEK ( f.feedback_time, 1 ) - WEEK ( DATE_FORMAT( f.feedback_time, '%Y-%m-01' ), 1 ) + 1 AS CHAR)
</select> </select>
<select id="getListByWorkunit" resultType="java.util.Map"> <select id="getListByWorkunit" resultType="java.util.Map">
SELECT SELECT
mw.workunit_code AS "工作单元编码", mw.workunit_code AS "工作单元编码",
mw.workunit_name AS "工作单元名称", mw.workunit_name AS "工作单元名称",
DATE_FORMAT( f.feedback_time, '%m' ) AS "报工日期", CAST( WEEK ( f.feedback_time, 1 ) - WEEK ( DATE_FORMAT( f.feedback_time, '%Y-%m-01' ), 1 ) + 1 AS CHAR) AS "报工日期",
sum( f.quantity ) AS quantity, sum( f.quantity ) AS quantity,
sum( f.quantity_qualify ) AS '合格数量', sum( f.quantity_qualify ) AS '合格数量',
sum( f.quantity_unqualify ) AS '不合格数量', sum( f.quantity_unqualify ) AS '不合格数量',
...@@ -104,18 +104,18 @@ ...@@ -104,18 +104,18 @@
<where> <where>
<if test=" workunitId != null">and workunit.workunit_id = #{workunitId}</if> <if test=" workunitId != null">and workunit.workunit_id = #{workunitId}</if>
<if test=" workunitName != null and workunitName != '' ">and mw.workunit_name like '%${workunitName}%'</if> <if test=" workunitName != null and workunitName != '' ">and mw.workunit_name like '%${workunitName}%'</if>
<if test="dateYear != null">and DATE_FORMAT(f.feedback_time, '%Y') = #{dateYear}</if> <if test="dateWeekly != null">and DATE_FORMAT(f.feedback_time, '%Y-%m') = #{dateWeekly}</if>
</where> </where>
group by group by
mw.workunit_code, mw.workunit_code,
mw.workunit_name, mw.workunit_name,
DATE_FORMAT( f.feedback_time, '%m' ) CAST( WEEK ( f.feedback_time, 1 ) - WEEK ( DATE_FORMAT( f.feedback_time, '%Y-%m-01' ), 1 ) + 1 AS CHAR)
</select> </select>
<select id="getListByUser" resultType="java.util.Map"> <select id="getListByUser" resultType="java.util.Map">
SELECT SELECT
IFNULL(f.user_name,'无') AS "报工人员编码", IFNULL(f.user_name,'无') AS "报工人员编码",
f.nick_name AS "报工人员名称", f.nick_name AS "报工人员名称",
DATE_FORMAT( f.feedback_time, '%m' ) AS "报工日期", CAST( WEEK ( f.feedback_time, 1 ) - WEEK ( DATE_FORMAT( f.feedback_time, '%Y-%m-01' ), 1 ) + 1 AS CHAR) AS "报工日期",
sum( f.quantity ) AS quantity, sum( f.quantity ) AS quantity,
sum( f.quantity_qualify ) AS '合格数量', sum( f.quantity_qualify ) AS '合格数量',
sum( f.quantity_unqualify ) AS '不合格数量', sum( f.quantity_unqualify ) AS '不合格数量',
...@@ -132,11 +132,11 @@ ...@@ -132,11 +132,11 @@
<where> <where>
<if test="userName != null and userName != ''">and f.user_name like concat('%', #{userName}, '%')</if> <if test="userName != null and userName != ''">and f.user_name like concat('%', #{userName}, '%')</if>
<if test=" nickName != null and nickName != '' ">and f.nick_Name like '%${nickName}%'</if> <if test=" nickName != null and nickName != '' ">and f.nick_Name like '%${nickName}%'</if>
<if test="dateYear != null">and DATE_FORMAT(f.feedback_time, '%Y') = #{dateYear}</if> <if test="dateWeekly != null">and DATE_FORMAT(f.feedback_time, '%Y-%m') = #{dateWeekly}</if>
</where> </where>
group by group by
IFNULL(f.user_name,'无'), IFNULL(f.user_name,'无'),
f.nick_name, f.nick_name,
DATE_FORMAT( f.feedback_time, '%m' ) CAST( WEEK ( f.feedback_time, 1 ) - WEEK ( DATE_FORMAT( f.feedback_time, '%Y-%m-01' ), 1 ) + 1 AS CHAR)
</select> </select>
</mapper> </mapper>
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