陈宜阳
8 months ago
15 changed files with 858 additions and 0 deletions
@ -0,0 +1,139 @@ |
|||
package com.win.module.mes.controller.mesholidaysetting; |
|||
|
|||
import io.swagger.v3.oas.annotations.Parameters; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import javax.annotation.Resource; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import io.swagger.v3.oas.annotations.tags.Tag; |
|||
import io.swagger.v3.oas.annotations.Parameter; |
|||
import io.swagger.v3.oas.annotations.Operation; |
|||
|
|||
import javax.validation.constraints.*; |
|||
import javax.validation.*; |
|||
import javax.servlet.http.*; |
|||
import java.time.LocalDateTime; |
|||
import java.time.ZoneOffset; |
|||
import java.util.*; |
|||
import java.io.IOException; |
|||
|
|||
import com.win.framework.common.pojo.PageResult; |
|||
import com.win.framework.common.pojo.CommonResult; |
|||
import static com.win.framework.common.pojo.CommonResult.success; |
|||
|
|||
import com.win.framework.excel.core.util.ExcelUtils; |
|||
|
|||
import com.win.framework.operatelog.core.annotations.OperateLog; |
|||
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.*; |
|||
|
|||
import com.win.module.mes.controller.mesholidaysetting.vo.*; |
|||
import com.win.module.mes.dal.dataobject.mesholidaysetting.MesHolidaySettingDO; |
|||
import com.win.module.mes.convert.mesholidaysetting.MesHolidaySettingConvert; |
|||
import com.win.module.mes.service.mesholidaysetting.MesHolidaySettingService; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
@Tag(name = "管理后台 - 节假日设置") |
|||
@RestController |
|||
@RequestMapping("/mes/holidaySetting") |
|||
@Validated |
|||
public class MesHolidaySettingController { |
|||
|
|||
@Resource |
|||
private MesHolidaySettingService holidaySettingService; |
|||
|
|||
@PostMapping("/create") |
|||
@Operation(summary = "创建节假日设置") |
|||
@PreAuthorize("@ss.hasPermission('mes:holidaySetting:create')") |
|||
public CommonResult<Long> createHolidaySetting(@Valid @RequestBody MesHolidaySettingCreateReqVO createReqVO) { |
|||
return success(holidaySettingService.createHolidaySetting(createReqVO)); |
|||
} |
|||
|
|||
@PutMapping("/update") |
|||
@Operation(summary = "更新节假日设置") |
|||
@PreAuthorize("@ss.hasPermission('mes:holidaySetting:update')") |
|||
public CommonResult<Boolean> updateHolidaySetting(@Valid @RequestBody MesHolidaySettingUpdateReqVO updateReqVO) { |
|||
int result = holidaySettingService.updateHolidaySetting(updateReqVO); |
|||
return success(result > 0); |
|||
} |
|||
|
|||
@DeleteMapping("/delete") |
|||
@Operation(summary = "删除节假日设置") |
|||
@Parameter(name = "id", description = "编号", required = true) |
|||
@PreAuthorize("@ss.hasPermission('mes:holidaySetting:delete')") |
|||
public CommonResult<Boolean> deleteHolidaySetting(@RequestParam("id") Long id) { |
|||
int result = holidaySettingService.deleteHolidaySetting(id); |
|||
return success(result > 0); |
|||
} |
|||
|
|||
@GetMapping("/get") |
|||
@Operation(summary = "获得节假日设置") |
|||
@Parameter(name = "id", description = "编号", required = true, example = "1024") |
|||
@PreAuthorize("@ss.hasPermission('mes:holidaySetting:query')") |
|||
public CommonResult<MesHolidaySettingRespVO> getHolidaySetting(@RequestParam("id") Long id) { |
|||
MesHolidaySettingDO holidaySetting = holidaySettingService.getHolidaySetting(id); |
|||
return success(MesHolidaySettingConvert.INSTANCE.convert(holidaySetting)); |
|||
} |
|||
|
|||
@GetMapping("/list") |
|||
@Operation(summary = "获得节假日设置列表") |
|||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") |
|||
@PreAuthorize("@ss.hasPermission('mes:holidaySetting:query')") |
|||
public CommonResult<List<MesHolidaySettingRespVO>> getHolidaySettingList(@RequestParam("ids") Collection<Long> ids) { |
|||
List<MesHolidaySettingDO> list = holidaySettingService.getHolidaySettingList(ids); |
|||
return success(MesHolidaySettingConvert.INSTANCE.convertList(list)); |
|||
} |
|||
|
|||
@GetMapping("/page") |
|||
@Operation(summary = "获得节假日设置分页") |
|||
@PreAuthorize("@ss.hasPermission('mes:holidaySetting:query')") |
|||
public CommonResult<PageResult<MesHolidaySettingRespVO>> getHolidaySettingPage(@Valid MesHolidaySettingPageReqVO pageVO) { |
|||
PageResult<MesHolidaySettingDO> pageResult = holidaySettingService.getHolidaySettingPage(pageVO); |
|||
return success(MesHolidaySettingConvert.INSTANCE.convertPage(pageResult)); |
|||
} |
|||
|
|||
@GetMapping("/export-excel") |
|||
@Operation(summary = "导出节假日设置 Excel") |
|||
@PreAuthorize("@ss.hasPermission('mes:holidaySetting:export')") |
|||
@OperateLog(type = EXPORT) |
|||
public void exportHolidaySettingExcel(@Valid MesHolidaySettingExportReqVO exportReqVO, |
|||
HttpServletResponse response) throws IOException { |
|||
List<MesHolidaySettingDO> list = holidaySettingService.getHolidaySettingList(exportReqVO); |
|||
// 导出 Excel
|
|||
List<MesHolidaySettingExcelVO> datas = MesHolidaySettingConvert.INSTANCE.convertList02(list); |
|||
ExcelUtils.write(response, "节假日设置.xls", "数据", MesHolidaySettingExcelVO.class, datas); |
|||
} |
|||
|
|||
@GetMapping("/get-import-template") |
|||
@Operation(summary = "获得导入节假日设置模板") |
|||
public void importTemplate(HttpServletResponse response) throws IOException { |
|||
List<MesHolidaySettingExcelVO> list = Arrays.asList(); |
|||
// 输出
|
|||
ExcelUtils.write(response, "节假日设置基本信息导入模板.xls", "节假日设置基本信息列表", MesHolidaySettingExcelVO.class, list); |
|||
} |
|||
|
|||
@PostMapping("/import") |
|||
@Operation(summary = "导入节假日设置基本信息") |
|||
@Parameters({ |
|||
@Parameter(name = "file", description = "Excel 文件", required = true), |
|||
@Parameter(name = "mode", description = "导入模式1更新2追加3覆盖", example = "1"), |
|||
@Parameter(name = "updatePart", description = "部分更新,默认为 true", example = "true") |
|||
}) |
|||
@PreAuthorize("@ss.hasPermission('mes:holiday-setting:import')") |
|||
public CommonResult<Map<String, Object>> importExcel(HttpServletResponse response, |
|||
@RequestParam("file") MultipartFile file, |
|||
@RequestParam(value = "mode") Integer mode, |
|||
@RequestParam(value = "updatePart", required = false, defaultValue = "false") Boolean updatePart) throws Exception { |
|||
|
|||
List<MesHolidaySettingExcelVO> list = ExcelUtils.read(file, MesHolidaySettingExcelVO.class); |
|||
List<MesHolidaySettingExcelVO> errorList = holidaySettingService.importMesHolidaySettingList(list, mode, updatePart); |
|||
|
|||
Map<String, Object> returnMap = new HashMap<>(); |
|||
returnMap.put("errorCount", errorList.size()); |
|||
if(!errorList.isEmpty()) { |
|||
String url = ExcelUtils.writeLocalFile("节假日设置基本信息导入错误数据" + LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8")) + ".xlsx", "错误列表", errorList); |
|||
returnMap.put("errorFile", url); |
|||
} |
|||
|
|||
return success(returnMap); |
|||
} |
|||
} |
@ -0,0 +1,70 @@ |
|||
package com.win.module.mes.controller.mesholidaysetting.vo; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.*; |
|||
import java.util.*; |
|||
import java.time.LocalDateTime; |
|||
import java.time.LocalDateTime; |
|||
import java.time.LocalDateTime; |
|||
import java.time.LocalDateTime; |
|||
import javax.validation.constraints.*; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import static com.win.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
|||
|
|||
/** |
|||
* 节假日设置 Base VO,提供给添加、修改、详细的子 VO 使用 |
|||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 |
|||
*/ |
|||
@Data |
|||
public class MesHolidaySettingBaseVO { |
|||
|
|||
@Schema(description = "备用字段一") |
|||
private String textOne; |
|||
|
|||
@Schema(description = "备用字段二") |
|||
private String textTwo; |
|||
|
|||
@Schema(description = "备用字段三") |
|||
private String textThree; |
|||
|
|||
@Schema(description = "备用字段四") |
|||
private String textFour; |
|||
|
|||
@Schema(description = "备用字段五") |
|||
private String textFive; |
|||
|
|||
@Schema(description = "删除时间") |
|||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
|||
private LocalDateTime deleteTime; |
|||
|
|||
@Schema(description = "状态", example = "2") |
|||
private String status; |
|||
|
|||
@Schema(description = "并发乐观锁", requiredMode = Schema.RequiredMode.REQUIRED) |
|||
@NotNull(message = "并发乐观锁不能为空") |
|||
private Integer concurrencyStamp; |
|||
|
|||
@Schema(description = "备注", example = "随便") |
|||
private String remark; |
|||
|
|||
@Schema(description = "删除用户名") |
|||
private String deleter; |
|||
|
|||
@Schema(description = "位置ID", example = "21742") |
|||
private Integer siteId; |
|||
|
|||
@Schema(description = "更改ID", example = "11261") |
|||
private Integer changeEmplId; |
|||
|
|||
@Schema(description = "节假日日期") |
|||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
|||
private LocalDateTime holidayDate; |
|||
|
|||
@Schema(description = "节假日类型") |
|||
private String holidayFlag; |
|||
|
|||
@Schema(description = "节假日名称", example = "芋艿") |
|||
private String holidayName; |
|||
|
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.win.module.mes.controller.mesholidaysetting.vo; |
|||
|
|||
import lombok.*; |
|||
import java.util.*; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import javax.validation.constraints.*; |
|||
|
|||
@Schema(description = "管理后台 - 节假日设置创建 Request VO") |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@ToString(callSuper = true) |
|||
public class MesHolidaySettingCreateReqVO extends MesHolidaySettingBaseVO { |
|||
|
|||
} |
@ -0,0 +1,72 @@ |
|||
package com.win.module.mes.controller.mesholidaysetting.vo; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.*; |
|||
import java.util.*; |
|||
import java.time.LocalDateTime; |
|||
import java.time.LocalDateTime; |
|||
import java.time.LocalDateTime; |
|||
import java.time.LocalDateTime; |
|||
|
|||
import com.alibaba.excel.annotation.ExcelProperty; |
|||
|
|||
/** |
|||
* 节假日设置 Excel VO |
|||
* |
|||
* @author 超级管理员 |
|||
*/ |
|||
@Data |
|||
public class MesHolidaySettingExcelVO { |
|||
|
|||
@ExcelProperty("id") |
|||
private Long id; |
|||
|
|||
@ExcelProperty("备用字段一") |
|||
private String textOne; |
|||
|
|||
@ExcelProperty("备用字段二") |
|||
private String textTwo; |
|||
|
|||
@ExcelProperty("备用字段三") |
|||
private String textThree; |
|||
|
|||
@ExcelProperty("备用字段四") |
|||
private String textFour; |
|||
|
|||
@ExcelProperty("备用字段五") |
|||
private String textFive; |
|||
|
|||
@ExcelProperty("删除时间") |
|||
private LocalDateTime deleteTime; |
|||
|
|||
@ExcelProperty("状态") |
|||
private String status; |
|||
|
|||
@ExcelProperty("并发乐观锁") |
|||
private Integer concurrencyStamp; |
|||
|
|||
@ExcelProperty("备注") |
|||
private String remark; |
|||
|
|||
@ExcelProperty("创建时间") |
|||
private LocalDateTime createTime; |
|||
|
|||
@ExcelProperty("删除用户名") |
|||
private String deleter; |
|||
|
|||
@ExcelProperty("位置ID") |
|||
private Integer siteId; |
|||
|
|||
@ExcelProperty("更改ID") |
|||
private Integer changeEmplId; |
|||
|
|||
@ExcelProperty("节假日日期") |
|||
private LocalDateTime holidayDate; |
|||
|
|||
@ExcelProperty("节假日类型") |
|||
private String holidayFlag; |
|||
|
|||
@ExcelProperty("节假日名称") |
|||
private String holidayName; |
|||
|
|||
} |
@ -0,0 +1,67 @@ |
|||
package com.win.module.mes.controller.mesholidaysetting.vo; |
|||
|
|||
import lombok.*; |
|||
import java.util.*; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import com.win.framework.common.pojo.PageParam; |
|||
import java.time.LocalDateTime; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import static com.win.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
|||
|
|||
@Schema(description = "管理后台 - 节假日设置 Excel 导出 Request VO,参数和 MesHolidaySettingPageReqVO 是一致的") |
|||
@Data |
|||
public class MesHolidaySettingExportReqVO { |
|||
|
|||
@Schema(description = "备用字段一") |
|||
private String textOne; |
|||
|
|||
@Schema(description = "备用字段二") |
|||
private String textTwo; |
|||
|
|||
@Schema(description = "备用字段三") |
|||
private String textThree; |
|||
|
|||
@Schema(description = "备用字段四") |
|||
private String textFour; |
|||
|
|||
@Schema(description = "备用字段五") |
|||
private String textFive; |
|||
|
|||
@Schema(description = "删除时间") |
|||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
|||
private LocalDateTime[] deleteTime; |
|||
|
|||
@Schema(description = "状态", example = "2") |
|||
private String status; |
|||
|
|||
@Schema(description = "并发乐观锁") |
|||
private Integer concurrencyStamp; |
|||
|
|||
@Schema(description = "备注", example = "随便") |
|||
private String remark; |
|||
|
|||
@Schema(description = "创建时间") |
|||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
|||
private LocalDateTime[] createTime; |
|||
|
|||
@Schema(description = "删除用户名") |
|||
private String deleter; |
|||
|
|||
@Schema(description = "位置ID", example = "21742") |
|||
private Integer siteId; |
|||
|
|||
@Schema(description = "更改ID", example = "11261") |
|||
private Integer changeEmplId; |
|||
|
|||
@Schema(description = "节假日日期") |
|||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
|||
private LocalDateTime[] holidayDate; |
|||
|
|||
@Schema(description = "节假日类型") |
|||
private String holidayFlag; |
|||
|
|||
@Schema(description = "节假日名称", example = "芋艿") |
|||
private String holidayName; |
|||
|
|||
} |
@ -0,0 +1,69 @@ |
|||
package com.win.module.mes.controller.mesholidaysetting.vo; |
|||
|
|||
import lombok.*; |
|||
import java.util.*; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import com.win.framework.common.pojo.PageParam; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
import java.time.LocalDateTime; |
|||
|
|||
import static com.win.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
|||
|
|||
@Schema(description = "管理后台 - 节假日设置分页 Request VO") |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@ToString(callSuper = true) |
|||
public class MesHolidaySettingPageReqVO extends PageParam { |
|||
|
|||
@Schema(description = "备用字段一") |
|||
private String textOne; |
|||
|
|||
@Schema(description = "备用字段二") |
|||
private String textTwo; |
|||
|
|||
@Schema(description = "备用字段三") |
|||
private String textThree; |
|||
|
|||
@Schema(description = "备用字段四") |
|||
private String textFour; |
|||
|
|||
@Schema(description = "备用字段五") |
|||
private String textFive; |
|||
|
|||
@Schema(description = "删除时间") |
|||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
|||
private LocalDateTime[] deleteTime; |
|||
|
|||
@Schema(description = "状态", example = "2") |
|||
private String status; |
|||
|
|||
@Schema(description = "并发乐观锁") |
|||
private Integer concurrencyStamp; |
|||
|
|||
@Schema(description = "备注", example = "随便") |
|||
private String remark; |
|||
|
|||
@Schema(description = "创建时间") |
|||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
|||
private LocalDateTime[] createTime; |
|||
|
|||
@Schema(description = "删除用户名") |
|||
private String deleter; |
|||
|
|||
@Schema(description = "位置ID", example = "21742") |
|||
private Integer siteId; |
|||
|
|||
@Schema(description = "更改ID", example = "11261") |
|||
private Integer changeEmplId; |
|||
|
|||
@Schema(description = "节假日日期") |
|||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
|||
private LocalDateTime[] holidayDate; |
|||
|
|||
@Schema(description = "节假日类型") |
|||
private String holidayFlag; |
|||
|
|||
@Schema(description = "节假日名称", example = "芋艿") |
|||
private String holidayName; |
|||
|
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.win.module.mes.controller.mesholidaysetting.vo; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.*; |
|||
import java.time.LocalDateTime; |
|||
|
|||
@Schema(description = "管理后台 - 节假日设置 Response VO") |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@ToString(callSuper = true) |
|||
public class MesHolidaySettingRespVO extends MesHolidaySettingBaseVO { |
|||
|
|||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "29789") |
|||
private Long id; |
|||
|
|||
@Schema(description = "创建时间") |
|||
private LocalDateTime createTime; |
|||
|
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.win.module.mes.controller.mesholidaysetting.vo; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.*; |
|||
import java.util.*; |
|||
import javax.validation.constraints.*; |
|||
|
|||
@Schema(description = "管理后台 - 节假日设置更新 Request VO") |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@ToString(callSuper = true) |
|||
public class MesHolidaySettingUpdateReqVO extends MesHolidaySettingBaseVO { |
|||
|
|||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "29789") |
|||
@NotNull(message = "id不能为空") |
|||
private Long id; |
|||
|
|||
} |
@ -0,0 +1,34 @@ |
|||
package com.win.module.mes.convert.mesholidaysetting; |
|||
|
|||
import java.util.*; |
|||
|
|||
import com.win.framework.common.pojo.PageResult; |
|||
|
|||
import org.mapstruct.Mapper; |
|||
import org.mapstruct.factory.Mappers; |
|||
import com.win.module.mes.controller.mesholidaysetting.vo.*; |
|||
import com.win.module.mes.dal.dataobject.mesholidaysetting.MesHolidaySettingDO; |
|||
|
|||
/** |
|||
* 节假日设置 Convert |
|||
* |
|||
* @author 超级管理员 |
|||
*/ |
|||
@Mapper |
|||
public interface MesHolidaySettingConvert { |
|||
|
|||
MesHolidaySettingConvert INSTANCE = Mappers.getMapper(MesHolidaySettingConvert.class); |
|||
|
|||
MesHolidaySettingDO convert(MesHolidaySettingCreateReqVO bean); |
|||
|
|||
MesHolidaySettingDO convert(MesHolidaySettingUpdateReqVO bean); |
|||
|
|||
MesHolidaySettingRespVO convert(MesHolidaySettingDO bean); |
|||
|
|||
List<MesHolidaySettingRespVO> convertList(List<MesHolidaySettingDO> list); |
|||
|
|||
PageResult<MesHolidaySettingRespVO> convertPage(PageResult<MesHolidaySettingDO> page); |
|||
|
|||
List<MesHolidaySettingExcelVO> convertList02(List<MesHolidaySettingDO> list); |
|||
|
|||
} |
@ -0,0 +1,92 @@ |
|||
package com.win.module.mes.dal.dataobject.mesholidaysetting; |
|||
|
|||
import lombok.*; |
|||
import java.util.*; |
|||
import java.time.LocalDateTime; |
|||
import java.time.LocalDateTime; |
|||
import java.time.LocalDateTime; |
|||
import java.time.LocalDateTime; |
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.win.framework.mybatis.core.dataobject.BaseDO; |
|||
|
|||
/** |
|||
* 节假日设置 DO |
|||
* |
|||
* @author 超级管理员 |
|||
*/ |
|||
@TableName("system_mes_holiday_setting") |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@ToString(callSuper = true) |
|||
@Builder |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class MesHolidaySettingDO extends BaseDO { |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
@TableId |
|||
private Long id; |
|||
/** |
|||
* 备用字段一 |
|||
*/ |
|||
private String textOne; |
|||
/** |
|||
* 备用字段二 |
|||
*/ |
|||
private String textTwo; |
|||
/** |
|||
* 备用字段三 |
|||
*/ |
|||
private String textThree; |
|||
/** |
|||
* 备用字段四 |
|||
*/ |
|||
private String textFour; |
|||
/** |
|||
* 备用字段五 |
|||
*/ |
|||
private String textFive; |
|||
/** |
|||
* 删除时间 |
|||
*/ |
|||
private LocalDateTime deleteTime; |
|||
/** |
|||
* 状态 |
|||
*/ |
|||
private String status; |
|||
/** |
|||
* 并发乐观锁 |
|||
*/ |
|||
private Integer concurrencyStamp; |
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
/** |
|||
* 删除用户名 |
|||
*/ |
|||
private String deleter; |
|||
/** |
|||
* 位置ID |
|||
*/ |
|||
private Integer siteId; |
|||
/** |
|||
* 更改ID |
|||
*/ |
|||
private Integer changeEmplId; |
|||
/** |
|||
* 节假日日期 |
|||
*/ |
|||
private LocalDateTime holidayDate; |
|||
/** |
|||
* 节假日类型 |
|||
*/ |
|||
private String holidayFlag; |
|||
/** |
|||
* 节假日名称 |
|||
*/ |
|||
private String holidayName; |
|||
|
|||
} |
@ -0,0 +1,62 @@ |
|||
package com.win.module.mes.dal.mysql.mesholidaysetting; |
|||
|
|||
import java.util.*; |
|||
|
|||
import com.win.framework.common.pojo.PageResult; |
|||
import com.win.framework.mybatis.core.query.LambdaQueryWrapperX; |
|||
import com.win.framework.mybatis.core.mapper.BaseMapperX; |
|||
import com.win.module.mes.dal.dataobject.mesholidaysetting.MesHolidaySettingDO; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import com.win.module.mes.controller.mesholidaysetting.vo.*; |
|||
|
|||
/** |
|||
* 节假日设置 Mapper |
|||
* |
|||
* @author 超级管理员 |
|||
*/ |
|||
@Mapper |
|||
public interface MesHolidaySettingMapper extends BaseMapperX<MesHolidaySettingDO> { |
|||
|
|||
default PageResult<MesHolidaySettingDO> selectPage(MesHolidaySettingPageReqVO reqVO) { |
|||
return selectPage(reqVO, new LambdaQueryWrapperX<MesHolidaySettingDO>() |
|||
.eqIfPresent(MesHolidaySettingDO::getTextOne, reqVO.getTextOne()) |
|||
.eqIfPresent(MesHolidaySettingDO::getTextTwo, reqVO.getTextTwo()) |
|||
.eqIfPresent(MesHolidaySettingDO::getTextThree, reqVO.getTextThree()) |
|||
.eqIfPresent(MesHolidaySettingDO::getTextFour, reqVO.getTextFour()) |
|||
.eqIfPresent(MesHolidaySettingDO::getTextFive, reqVO.getTextFive()) |
|||
.betweenIfPresent(MesHolidaySettingDO::getDeleteTime, reqVO.getDeleteTime()) |
|||
.eqIfPresent(MesHolidaySettingDO::getStatus, reqVO.getStatus()) |
|||
.eqIfPresent(MesHolidaySettingDO::getConcurrencyStamp, reqVO.getConcurrencyStamp()) |
|||
.eqIfPresent(MesHolidaySettingDO::getRemark, reqVO.getRemark()) |
|||
.betweenIfPresent(MesHolidaySettingDO::getCreateTime, reqVO.getCreateTime()) |
|||
.eqIfPresent(MesHolidaySettingDO::getDeleter, reqVO.getDeleter()) |
|||
.eqIfPresent(MesHolidaySettingDO::getSiteId, reqVO.getSiteId()) |
|||
.eqIfPresent(MesHolidaySettingDO::getChangeEmplId, reqVO.getChangeEmplId()) |
|||
.betweenIfPresent(MesHolidaySettingDO::getHolidayDate, reqVO.getHolidayDate()) |
|||
.eqIfPresent(MesHolidaySettingDO::getHolidayFlag, reqVO.getHolidayFlag()) |
|||
.likeIfPresent(MesHolidaySettingDO::getHolidayName, reqVO.getHolidayName()) |
|||
.orderByDesc(MesHolidaySettingDO::getId)); |
|||
} |
|||
|
|||
default List<MesHolidaySettingDO> selectList(MesHolidaySettingExportReqVO reqVO) { |
|||
return selectList(new LambdaQueryWrapperX<MesHolidaySettingDO>() |
|||
.eqIfPresent(MesHolidaySettingDO::getTextOne, reqVO.getTextOne()) |
|||
.eqIfPresent(MesHolidaySettingDO::getTextTwo, reqVO.getTextTwo()) |
|||
.eqIfPresent(MesHolidaySettingDO::getTextThree, reqVO.getTextThree()) |
|||
.eqIfPresent(MesHolidaySettingDO::getTextFour, reqVO.getTextFour()) |
|||
.eqIfPresent(MesHolidaySettingDO::getTextFive, reqVO.getTextFive()) |
|||
.betweenIfPresent(MesHolidaySettingDO::getDeleteTime, reqVO.getDeleteTime()) |
|||
.eqIfPresent(MesHolidaySettingDO::getStatus, reqVO.getStatus()) |
|||
.eqIfPresent(MesHolidaySettingDO::getConcurrencyStamp, reqVO.getConcurrencyStamp()) |
|||
.eqIfPresent(MesHolidaySettingDO::getRemark, reqVO.getRemark()) |
|||
.betweenIfPresent(MesHolidaySettingDO::getCreateTime, reqVO.getCreateTime()) |
|||
.eqIfPresent(MesHolidaySettingDO::getDeleter, reqVO.getDeleter()) |
|||
.eqIfPresent(MesHolidaySettingDO::getSiteId, reqVO.getSiteId()) |
|||
.eqIfPresent(MesHolidaySettingDO::getChangeEmplId, reqVO.getChangeEmplId()) |
|||
.betweenIfPresent(MesHolidaySettingDO::getHolidayDate, reqVO.getHolidayDate()) |
|||
.eqIfPresent(MesHolidaySettingDO::getHolidayFlag, reqVO.getHolidayFlag()) |
|||
.likeIfPresent(MesHolidaySettingDO::getHolidayName, reqVO.getHolidayName()) |
|||
.orderByDesc(MesHolidaySettingDO::getId)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,79 @@ |
|||
package com.win.module.mes.service.mesholidaysetting; |
|||
|
|||
import java.util.*; |
|||
import javax.validation.*; |
|||
import com.win.module.mes.controller.mesholidaysetting.vo.*; |
|||
import com.win.module.mes.dal.dataobject.mesholidaysetting.MesHolidaySettingDO; |
|||
import com.win.framework.common.pojo.PageResult; |
|||
|
|||
/** |
|||
* 节假日设置 Service 接口 |
|||
* |
|||
* @author 超级管理员 |
|||
*/ |
|||
public interface MesHolidaySettingService { |
|||
|
|||
/** |
|||
* 创建节假日设置 |
|||
* |
|||
* @param createReqVO 创建信息 |
|||
* @return 编号 |
|||
*/ |
|||
Long createHolidaySetting(@Valid MesHolidaySettingCreateReqVO createReqVO); |
|||
|
|||
/** |
|||
* 更新节假日设置 |
|||
* |
|||
* @param updateReqVO 更新信息 |
|||
*/ |
|||
Integer updateHolidaySetting(@Valid MesHolidaySettingUpdateReqVO updateReqVO); |
|||
|
|||
/** |
|||
* 删除节假日设置 |
|||
* |
|||
* @param id 编号 |
|||
*/ |
|||
Integer deleteHolidaySetting(Long id); |
|||
|
|||
/** |
|||
* 获得节假日设置 |
|||
* |
|||
* @param id 编号 |
|||
* @return 节假日设置 |
|||
*/ |
|||
MesHolidaySettingDO getHolidaySetting(Long id); |
|||
|
|||
/** |
|||
* 获得节假日设置列表 |
|||
* |
|||
* @param ids 编号 |
|||
* @return 节假日设置列表 |
|||
*/ |
|||
List<MesHolidaySettingDO> getHolidaySettingList(Collection<Long> ids); |
|||
|
|||
/** |
|||
* 获得节假日设置分页 |
|||
* |
|||
* @param pageReqVO 分页查询 |
|||
* @return 节假日设置分页 |
|||
*/ |
|||
PageResult<MesHolidaySettingDO> getHolidaySettingPage(MesHolidaySettingPageReqVO pageReqVO); |
|||
|
|||
/** |
|||
* 获得节假日设置列表, 用于 Excel 导出 |
|||
* |
|||
* @param exportReqVO 查询条件 |
|||
* @return 节假日设置列表 |
|||
*/ |
|||
List<MesHolidaySettingDO> getHolidaySettingList(MesHolidaySettingExportReqVO exportReqVO); |
|||
|
|||
/** |
|||
* 导入节假日设置主信息 |
|||
* |
|||
* @param datas 导入节假日设置主信息列表 |
|||
* @param mode 导入模式1更新2追加3覆盖 |
|||
* @param updatePart 是否支持更新 |
|||
* @return 导入结果 |
|||
*/ |
|||
public List<MesHolidaySettingExcelVO> importMesHolidaySettingList(List<MesHolidaySettingExcelVO> datas, Integer mode, boolean updatePart); |
|||
} |
@ -0,0 +1,107 @@ |
|||
package com.win.module.mes.service.mesholidaysetting; |
|||
|
|||
import cn.hutool.core.collection.CollUtil; |
|||
import org.springframework.stereotype.Service; |
|||
import javax.annotation.Resource; |
|||
import org.springframework.validation.annotation.Validated; |
|||
|
|||
import java.util.*; |
|||
import com.win.module.mes.controller.mesholidaysetting.vo.*; |
|||
import com.win.module.mes.dal.dataobject.mesholidaysetting.MesHolidaySettingDO; |
|||
import com.win.framework.common.pojo.PageResult; |
|||
|
|||
import com.win.module.mes.convert.mesholidaysetting.MesHolidaySettingConvert; |
|||
import com.win.module.mes.dal.mysql.mesholidaysetting.MesHolidaySettingMapper; |
|||
|
|||
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception; |
|||
import static com.win.module.mes.enums.ErrorCodeConstants.*; |
|||
|
|||
/** |
|||
* 节假日设置 Service 实现类 |
|||
* |
|||
* @author 超级管理员 |
|||
*/ |
|||
@Service |
|||
@Validated |
|||
public class MesHolidaySettingServiceImpl implements MesHolidaySettingService { |
|||
|
|||
@Resource |
|||
private MesHolidaySettingMapper holidaySettingMapper; |
|||
|
|||
@Override |
|||
public Long createHolidaySetting(MesHolidaySettingCreateReqVO createReqVO) { |
|||
// 插入
|
|||
MesHolidaySettingDO holidaySetting = MesHolidaySettingConvert.INSTANCE.convert(createReqVO); |
|||
holidaySettingMapper.insert(holidaySetting); |
|||
// 返回
|
|||
return holidaySetting.getId(); |
|||
} |
|||
|
|||
@Override |
|||
public Integer updateHolidaySetting(MesHolidaySettingUpdateReqVO updateReqVO) { |
|||
// 校验存在
|
|||
validateHolidaySettingExists(updateReqVO.getId()); |
|||
// 更新
|
|||
MesHolidaySettingDO updateObj = MesHolidaySettingConvert.INSTANCE.convert(updateReqVO); |
|||
return holidaySettingMapper.updateById(updateObj); |
|||
} |
|||
|
|||
@Override |
|||
public Integer deleteHolidaySetting(Long id) { |
|||
// 校验存在
|
|||
validateHolidaySettingExists(id); |
|||
// 删除
|
|||
return holidaySettingMapper.deleteById(id); |
|||
} |
|||
|
|||
private void validateHolidaySettingExists(Long id) { |
|||
if (holidaySettingMapper.selectById(id) == null) { |
|||
throw exception(HOLIDAY_SETTING_NOT_EXISTS); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public MesHolidaySettingDO getHolidaySetting(Long id) { |
|||
return holidaySettingMapper.selectById(id); |
|||
} |
|||
|
|||
@Override |
|||
public List<MesHolidaySettingDO> getHolidaySettingList(Collection<Long> ids) { |
|||
return holidaySettingMapper.selectBatchIds(ids); |
|||
} |
|||
|
|||
@Override |
|||
public PageResult<MesHolidaySettingDO> getHolidaySettingPage(MesHolidaySettingPageReqVO pageReqVO) { |
|||
return holidaySettingMapper.selectPage(pageReqVO); |
|||
} |
|||
|
|||
@Override |
|||
public List<MesHolidaySettingDO> getHolidaySettingList(MesHolidaySettingExportReqVO exportReqVO) { |
|||
return holidaySettingMapper.selectList(exportReqVO); |
|||
} |
|||
|
|||
@Override |
|||
public List<MesHolidaySettingExcelVO> importMesHolidaySettingList(List<MesHolidaySettingExcelVO> datas, Integer mode, boolean updatePart) { |
|||
if (CollUtil.isEmpty(datas)) { |
|||
throw exception(HOLIDAY_SETTING_IMPORT_LIST_IS_EMPTY); |
|||
} |
|||
|
|||
List<MesHolidaySettingExcelVO> errorList = new ArrayList<>(); |
|||
// datas.forEach(item -> {
|
|||
// if(errorList == null){
|
|||
// // 判断如果不存在,在进行插入
|
|||
// MesHolidaySettingDO obj = holidaySettingMapper.selectByCode(item.getCode());
|
|||
// if (obj == null&& mode != 3) {
|
|||
// holidaySettingMapper.insert(MesHolidaySettingConvert.INSTANCE.convert(item));
|
|||
// }
|
|||
// else if (obj != null && mode != 2) {// 如果存在,判断是否允许更新
|
|||
// MesHolidaySettingDO holidaySettingDO = MesHolidaySettingConvert.INSTANCE.convert(item);
|
|||
// holidaySettingDO.setId(obj.getId());
|
|||
// holidaySettingMapper.updateById(obj);
|
|||
// }
|
|||
// }
|
|||
// });
|
|||
|
|||
return errorList; |
|||
} |
|||
} |
@ -0,0 +1,12 @@ |
|||
<?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.win.module.mes.dal.mysql.mesholidaysetting.MesHolidaySettingMapper"> |
|||
|
|||
<!-- |
|||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。 |
|||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。 |
|||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 |
|||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ |
|||
--> |
|||
|
|||
</mapper> |
Loading…
Reference in new issue