装箱单信息查询排序
This commit is contained in:
@@ -19,7 +19,7 @@ public class CodeGenerator {
|
||||
|
||||
@Test
|
||||
public void test(){
|
||||
mybatisPlusGenerator(new String[]{"t_wo_power_level"});
|
||||
mybatisPlusGenerator(new String[]{"t_working_time"});
|
||||
}
|
||||
|
||||
public static void mybatisPlusGenerator(String[] include){
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.cnbm.generator.code.controller;
|
||||
|
||||
import com.cnbm.admin.annotation.LogOperation;
|
||||
import com.cnbm.common.constant.Constant;
|
||||
import com.cnbm.common.page.PageData;
|
||||
import com.cnbm.common.utils.ExcelUtils;
|
||||
import com.cnbm.common.utils.Result;
|
||||
import com.cnbm.common.validator.AssertUtils;
|
||||
import com.cnbm.common.validator.ValidatorUtils;
|
||||
import com.cnbm.common.validator.group.AddGroup;
|
||||
import com.cnbm.common.validator.group.DefaultGroup;
|
||||
import com.cnbm.common.validator.group.UpdateGroup;
|
||||
import com.cnbm.generator.code.dto.WorkingTimeDTO;
|
||||
import com.cnbm.generator.code.excel.WorkingTimeExcel;
|
||||
import com.cnbm.generator.code.service.WorkingTimeServiceBiz;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 班次时间段 表 前端控制器
|
||||
*
|
||||
* @author codeGenerator
|
||||
* @since 2023-12-20
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/code/workingTime")
|
||||
@Api(tags="班次时间段 表")
|
||||
public class WorkingTimeController {
|
||||
@Autowired
|
||||
private WorkingTimeServiceBiz workingTimeService;
|
||||
|
||||
@GetMapping("page")
|
||||
@ApiOperation("分页")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataTypeClass=Integer.class) ,
|
||||
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) ,
|
||||
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.class) ,
|
||||
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class)
|
||||
})
|
||||
@PreAuthorize("@ex.hasAuthority('code:workingTime:page')")
|
||||
public Result<PageData<WorkingTimeDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
|
||||
PageData<WorkingTimeDTO> page = workingTimeService.page(params);
|
||||
|
||||
return new Result<PageData<WorkingTimeDTO>>().ok(page);
|
||||
}
|
||||
|
||||
@GetMapping("{id}")
|
||||
@ApiOperation("信息")
|
||||
@PreAuthorize("@ex.hasAuthority('code:workingTime:info')")
|
||||
public Result<WorkingTimeDTO> get(@PathVariable("id") Long id){
|
||||
WorkingTimeDTO data = workingTimeService.get(id);
|
||||
|
||||
return new Result<WorkingTimeDTO>().ok(data);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation("保存")
|
||||
@LogOperation("保存")
|
||||
@PreAuthorize("@ex.hasAuthority('code:workingTime:save')")
|
||||
public Result<Long> save(@RequestBody WorkingTimeDTO dto){
|
||||
//效验数据
|
||||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
|
||||
|
||||
workingTimeService.save(dto);
|
||||
|
||||
return new Result<Long>().ok(dto.getId());
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation("修改")
|
||||
@LogOperation("修改")
|
||||
@PreAuthorize("@ex.hasAuthority('code:workingTime:update')")
|
||||
public Result<Long> update(@RequestBody WorkingTimeDTO dto){
|
||||
//效验数据
|
||||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
|
||||
|
||||
workingTimeService.update(dto);
|
||||
|
||||
return new Result<Long>().ok(dto.getId());
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@ApiOperation("删除")
|
||||
@LogOperation("删除")
|
||||
@PreAuthorize("@ex.hasAuthority('code:workingTime:delete')")
|
||||
public Result delete(@RequestBody Long[] ids){
|
||||
//效验数据
|
||||
AssertUtils.isArrayEmpty(ids, "id");
|
||||
|
||||
workingTimeService.delete(ids);
|
||||
|
||||
return new Result();
|
||||
}
|
||||
|
||||
@GetMapping("export")
|
||||
@ApiOperation("导出")
|
||||
@LogOperation("导出")
|
||||
@PreAuthorize("@ex.hasAuthority('code:workingTime:export')")
|
||||
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
|
||||
List<WorkingTimeDTO> list = workingTimeService.list(params);
|
||||
|
||||
ExcelUtils.exportExcelToTarget(response, null, list, WorkingTimeExcel.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.cnbm.generator.code.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
/**
|
||||
* 班次时间段 表
|
||||
*
|
||||
* @author codeGenerator
|
||||
* @since 2023-12-20
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "班次时间段 表DTO对象")
|
||||
public class WorkingTimeDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
|
||||
@ApiModelProperty(value = "ID")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "班次名 ,A/B/C...")
|
||||
private String orderName;
|
||||
|
||||
@ApiModelProperty(value = "班次开始时间, 0点 - 24点")
|
||||
private LocalDateTime beginTime;
|
||||
|
||||
@ApiModelProperty(value = "班次结束时间, 0点 - 24点")
|
||||
private LocalDateTime endTime;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(value = "删除标志,是否有效:1 可用 0不可用")
|
||||
private Integer valid;
|
||||
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private Long creatorId;
|
||||
|
||||
@ApiModelProperty(value = "创建人姓名")
|
||||
private String creatorName;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private Long updaterId;
|
||||
|
||||
@ApiModelProperty(value = "更新人姓名")
|
||||
private String updaterName;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@ApiModelProperty(value = "版本号")
|
||||
private Integer version;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.cnbm.generator.code.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 班次时间段 表
|
||||
* </p>
|
||||
*
|
||||
* @author codeGenerator
|
||||
* @since 2023-12-20
|
||||
*/
|
||||
@Data
|
||||
@TableName("t_working_time")
|
||||
@ApiModel(value = "WorkingTime对象", description = "班次时间段 表")
|
||||
public class WorkingTime implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("ID")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("班次名 ,A/B/C...")
|
||||
private String orderName;
|
||||
|
||||
@ApiModelProperty("班次开始时间, 0点 - 24点")
|
||||
private LocalDateTime beginTime;
|
||||
|
||||
@ApiModelProperty("班次结束时间, 0点 - 24点")
|
||||
private LocalDateTime endTime;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty("删除标志,是否有效:1 可用 0不可用")
|
||||
@TableLogic
|
||||
private Integer valid;
|
||||
|
||||
@ApiModelProperty("创建人")
|
||||
private Long creatorId;
|
||||
|
||||
@ApiModelProperty("创建人姓名")
|
||||
private String creatorName;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty("更新人")
|
||||
private Long updaterId;
|
||||
|
||||
@ApiModelProperty("更新人姓名")
|
||||
private String updaterName;
|
||||
|
||||
@ApiModelProperty("更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@ApiModelProperty("版本号")
|
||||
private Integer version;
|
||||
|
||||
|
||||
public static final String ID = "id";
|
||||
|
||||
public static final String ORDER_NAME = "order_name";
|
||||
|
||||
public static final String BEGIN_TIME = "begin_time";
|
||||
|
||||
public static final String END_TIME = "end_time";
|
||||
|
||||
public static final String REMARK = "remark";
|
||||
|
||||
public static final String VALID = "valid";
|
||||
|
||||
public static final String CREATOR_ID = "creator_id";
|
||||
|
||||
public static final String CREATOR_NAME = "creator_name";
|
||||
|
||||
public static final String CREATE_TIME = "create_time";
|
||||
|
||||
public static final String UPDATER_ID = "updater_id";
|
||||
|
||||
public static final String UPDATER_NAME = "updater_name";
|
||||
|
||||
public static final String UPDATE_TIME = "update_time";
|
||||
|
||||
public static final String VERSION = "version";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.cnbm.generator.code.excel;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 班次时间段 表
|
||||
*
|
||||
* @author codeGenerator
|
||||
* @since 2023-12-20
|
||||
*/
|
||||
@Data
|
||||
public class WorkingTimeExcel {
|
||||
@Excel(name = "ID")
|
||||
private Long id;
|
||||
@Excel(name = "班次名 ,A/B/C...")
|
||||
private String orderName;
|
||||
@Excel(name = "班次开始时间, 0点 - 24点")
|
||||
private LocalDateTime beginTime;
|
||||
@Excel(name = "班次结束时间, 0点 - 24点")
|
||||
private LocalDateTime endTime;
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
@Excel(name = "删除标志,是否有效:1 可用 0不可用")
|
||||
private Integer valid;
|
||||
@Excel(name = "创建人")
|
||||
private Long creatorId;
|
||||
@Excel(name = "创建人姓名")
|
||||
private String creatorName;
|
||||
@Excel(name = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
@Excel(name = "更新人")
|
||||
private Long updaterId;
|
||||
@Excel(name = "更新人姓名")
|
||||
private String updaterName;
|
||||
@Excel(name = "更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
@Excel(name = "版本号")
|
||||
private Integer version;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.cnbm.generator.code.mapper;
|
||||
|
||||
import com.cnbm.common.dao.BaseDao;
|
||||
import com.cnbm.generator.code.entity.WorkingTime;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 班次时间段 表
|
||||
*
|
||||
* @author codeGenerator
|
||||
* @since 2023-12-20
|
||||
*/
|
||||
@Mapper
|
||||
public interface WorkingTimeMapper extends BaseDao<WorkingTime> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?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.cnbm.generator.code.mapper.WorkingTimeMapper">
|
||||
<resultMap type="com.cnbm.generator.code.entity.WorkingTime" id="WorkingTimeMap">
|
||||
<id column="id" property="id" />
|
||||
<id column="order_name" property="orderName" />
|
||||
<id column="begin_time" property="beginTime" />
|
||||
<id column="end_time" property="endTime" />
|
||||
<id column="remark" property="remark" />
|
||||
<id column="valid" property="valid" />
|
||||
<id column="creator_id" property="creatorId" />
|
||||
<id column="creator_name" property="creatorName" />
|
||||
<id column="create_time" property="createTime" />
|
||||
<id column="updater_id" property="updaterId" />
|
||||
<id column="updater_name" property="updaterName" />
|
||||
<id column="update_time" property="updateTime" />
|
||||
<id column="version" property="version" />
|
||||
</resultMap>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,7 @@
|
||||
-- 菜单初始SQL
|
||||
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date)VALUES (1737360876993064962, 1067246875800000035, '班次时间段 表', 'code/workingTime', NULL, 0, 'icon-desktop', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1737360876993064963, 1737360876993064962, '查看', NULL, 'code:workingTime:page,code:workingTime:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1737360876993064964, 1737360876993064962, '新增', NULL, 'code:workingTime:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1737360876993064965, 1737360876993064962, '修改', NULL, 'code:workingTime:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1737360876993064966, 1737360876993064962, '删除', NULL, 'code:workingTime:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1737360876993064967, 1737360876993064962, '导出', NULL, 'code:workingTime:export', 1, NULL, 4, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.cnbm.generator.code.service;
|
||||
|
||||
import com.cnbm.common.service.CrudService;
|
||||
import com.cnbm.generator.code.dto.WorkingTimeDTO;
|
||||
import com.cnbm.generator.code.entity.WorkingTime;
|
||||
|
||||
/**
|
||||
* 班次时间段 表
|
||||
*
|
||||
* @author codeGenerator
|
||||
* @since 2023-12-20
|
||||
*/
|
||||
public interface WorkingTimeServiceBiz extends CrudService<WorkingTime, WorkingTimeDTO> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.cnbm.generator.code.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.cnbm.common.service.impl.CrudServiceImpl;
|
||||
import com.cnbm.generator.code.dto.WorkingTimeDTO;
|
||||
import com.cnbm.generator.code.mapper.WorkingTimeMapper;
|
||||
import com.cnbm.generator.code.entity.WorkingTime;
|
||||
import com.cnbm.generator.code.service.WorkingTimeServiceBiz;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 班次时间段 表
|
||||
*
|
||||
* @author codeGenerator
|
||||
* @since 2023-12-20
|
||||
*/
|
||||
@Service
|
||||
public class WorkingTimeServiceBizImpl extends CrudServiceImpl<WorkingTimeMapper, WorkingTime, WorkingTimeDTO> implements WorkingTimeServiceBiz {
|
||||
|
||||
@Override
|
||||
public QueryWrapper<WorkingTime> getWrapper(Map<String, Object> params){
|
||||
String id = (String)params.get("id");
|
||||
|
||||
QueryWrapper<WorkingTime> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user