zhousq
1 year ago
36 changed files with 1490 additions and 900 deletions
@ -0,0 +1,142 @@ |
|||
package com.lzbi.asset.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.lzbi.code.service.CodeNoGenerater; |
|||
import com.lzbi.common.annotation.Log; |
|||
import com.lzbi.common.core.controller.BaseController; |
|||
import com.lzbi.common.core.domain.AjaxResult; |
|||
import com.lzbi.common.core.page.TableDataInfo; |
|||
import com.lzbi.common.enums.BusinessType; |
|||
import com.lzbi.common.utils.DateUtils; |
|||
import com.lzbi.common.utils.poi.ExcelUtil; |
|||
import com.lzbi.task.service.WorkParamReadService; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import javax.validation.Valid; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
import com.lzbi.asset.domain.DcBusiWorkReadConfig; |
|||
import com.lzbi.asset.service.DcBusiWorkReadConfigService; |
|||
|
|||
/** |
|||
* 互联参数读取数据对照表;(dc_busi_work_read_config)表控制层 |
|||
* @author : zhousq |
|||
* @date : 2023-11-30 |
|||
*/ |
|||
@Api(tags = "互联参数读取数据对照表对象功能接口") |
|||
@RestController |
|||
@RequestMapping("/asset/dcBusiWorkReadConfig") |
|||
public class DcBusiWorkReadConfigController extends BaseController{ |
|||
@Autowired |
|||
private DcBusiWorkReadConfigService dcBusiWorkReadConfigService; |
|||
|
|||
/** |
|||
* 分页列表查询 |
|||
* @return 分页数据 |
|||
*/ |
|||
@GetMapping("/list") |
|||
public TableDataInfo list(DcBusiWorkReadConfig dcBusiWorkReadConfig) |
|||
{ startPage(); |
|||
List<DcBusiWorkReadConfig> list = null; |
|||
return getDataTable(list); |
|||
} |
|||
/** |
|||
*根据ID获取详情 |
|||
*@param id |
|||
@return DcBusiWorkReadConfig 没有反馈空 |
|||
*/ |
|||
@ApiOperation("根据ID获取互联参数读取数据对照表详细信息") |
|||
@GetMapping(value = "/{id}") |
|||
public AjaxResult getInfo(@PathVariable("id") Long id) { |
|||
return AjaxResult.success(dcBusiWorkReadConfigService.getById(id)); |
|||
} |
|||
/** |
|||
* 互联参数读取数据对照表-新增 |
|||
*@param |
|||
*@return DcBusiWorkReadConfig |
|||
*/ |
|||
@ApiOperation("新增互联参数读取数据对照表一条数据") |
|||
@Log(title = "", businessType = BusinessType.INSERT) |
|||
@PostMapping |
|||
public AjaxResult add(@Valid @RequestBody DcBusiWorkReadConfig dcBusiWorkReadConfig) { |
|||
//BeanValidators.validateWithException(validator, dcBusiWorkReadConfig);
|
|||
dcBusiWorkReadConfig.setCreatedBy(getUsername()); |
|||
dcBusiWorkReadConfig.setCreatedTime(DateUtils.getNowDate()); |
|||
dcBusiWorkReadConfig.setTenantId("0"); |
|||
dcBusiWorkReadConfig.setUpdatedBy(getUsername()); |
|||
dcBusiWorkReadConfig.setUpdatedTime(DateUtils.getNowDate()); |
|||
return toAjax(true); |
|||
} |
|||
/** |
|||
* 互联参数读取数据对照表-修改 |
|||
*@param |
|||
*@return DcBusiWorkReadConfig |
|||
*/ |
|||
@ApiOperation("互联参数读取数据对照表修改") |
|||
@Log(title = "", businessType = BusinessType.UPDATE) |
|||
@PutMapping |
|||
public AjaxResult edit(@Valid @RequestBody DcBusiWorkReadConfig dcBusiWorkReadConfig) { |
|||
//BeanValidators.validateWithException(validator, dcBusiWorkReadConfig);
|
|||
dcBusiWorkReadConfig.setUpdatedBy(getUsername()); |
|||
dcBusiWorkReadConfig.setUpdatedTime(DateUtils.getNowDate()); |
|||
return toAjax(dcBusiWorkReadConfigService.updateById(dcBusiWorkReadConfig)); |
|||
} |
|||
/** |
|||
* 通过ID删除互联参数读取数据对照表 |
|||
* @param id |
|||
* @return 成功1 失败0 |
|||
*/ |
|||
@ApiOperation("根据ID删除互联参数读取数据对照表") |
|||
@Log(title = "单一互联参数读取数据对照表", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/id/{id}") |
|||
public AjaxResult batchRemove(@PathVariable Long id) { |
|||
DcBusiWorkReadConfig dcBusiWorkReadConfig=new DcBusiWorkReadConfig(); |
|||
dcBusiWorkReadConfig.setId(id); |
|||
return toAjax(dcBusiWorkReadConfigService.removeById( dcBusiWorkReadConfig)); |
|||
} |
|||
/** |
|||
* 批量删除互联参数读取数据对照表 |
|||
* @param ids 数组 |
|||
* @return 删除的条数 |
|||
*/ |
|||
@ApiOperation("批量删除互联参数读取数据对照表") |
|||
@Log(title = "批量删除互联参数读取数据对照表", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/ids/{ids}") |
|||
public AjaxResult batchRemove(@PathVariable Long[] ids) { |
|||
List<Long> collect = Arrays.stream(ids).collect(Collectors.toList()); |
|||
return toAjax(dcBusiWorkReadConfigService.removeBatchByIds(collect)); |
|||
} |
|||
/** |
|||
* 通过模版导入"互联参数读取数据对照表数据 |
|||
* |
|||
*/ |
|||
@ApiOperation("互联参数读取数据对照表数据导入") |
|||
@PostMapping("/importTemplate") |
|||
public void importTemplate(HttpServletResponse response) { |
|||
ExcelUtil<DcBusiWorkReadConfig> util = new ExcelUtil<>(DcBusiWorkReadConfig.class); |
|||
util.importTemplateExcel(response, "互联参数读取数据对照表导出数据"); |
|||
} |
|||
/** |
|||
* "互联参数读取数据对照表数据导出功能 |
|||
*/ |
|||
@ApiOperation("导出互联参数读取数据对照表数据") |
|||
@PostMapping("/export") |
|||
public void export(HttpServletResponse response, DcBusiWorkReadConfig dcBusiWorkReadConfig) { |
|||
QueryWrapper<DcBusiWorkReadConfig> queryWrapper = new QueryWrapper<>(); |
|||
List<DcBusiWorkReadConfig> list = dcBusiWorkReadConfigService.list(queryWrapper); |
|||
ExcelUtil<DcBusiWorkReadConfig> util = new ExcelUtil<>(DcBusiWorkReadConfig.class); |
|||
util.exportExcel(response, list, "导出的互联参数读取数据对照表数据"); |
|||
} |
|||
@Autowired |
|||
WorkParamReadService workParamReadService; |
|||
@Autowired |
|||
CodeNoGenerater codeNoGenerater; |
|||
@GetMapping("/getWork") |
|||
public AjaxResult getWorkParamValue(){ |
|||
return success(); |
|||
} |
|||
} |
@ -0,0 +1,52 @@ |
|||
package com.lzbi.asset.domain; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import java.util.Date; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
import lombok.experimental.Accessors; |
|||
import com.lzbi.module.base.BaseModuleEntity; |
|||
|
|||
/** |
|||
* 互联参数读取数据对照表; |
|||
* @author : zhousq |
|||
* @date : 2023-11-30 |
|||
*/ |
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
@Accessors(chain = true) |
|||
@ApiModel(value = "互联参数读取数据对照表",description = "") |
|||
@TableName("dc_busi_work_read_config") |
|||
public class DcBusiWorkReadConfig extends BaseModuleEntity{ |
|||
/** 主键 */ |
|||
@ApiModelProperty(name = "主键",notes = "") |
|||
@TableId |
|||
private Long id ; |
|||
/** 统计单元编码 */ |
|||
@ApiModelProperty(name = "统计单元编码",notes = "") |
|||
private String assetCode ; |
|||
/** 统计单元参数编码 */ |
|||
@ApiModelProperty(name = "统计单元参数编码",notes = "") |
|||
private String assetParamCode ; |
|||
/** 目标参数编码 */ |
|||
@ApiModelProperty(name = "目标参数编码",notes = "") |
|||
private String goalParamCode ; |
|||
/** 目标参数辅助查询参数1 */ |
|||
@ApiModelProperty(name = "目标参数辅助查询参数1",notes = "") |
|||
private String goalParamExt1 ; |
|||
/** 目标参数辅助查询参数2 */ |
|||
@ApiModelProperty(name = "目标参数辅助查询参数2",notes = "") |
|||
private String goalParamExt2 ; |
|||
/** 读取数值类型 */ |
|||
@ApiModelProperty(name = "读取数值类型",notes = "") |
|||
private String goalParamType ; |
|||
/** 数据来源;生产IOT:work;计费:charge;Erp:erp */ |
|||
@ApiModelProperty(name = "数据来源",notes = "生产IOT:work;计费:charge;Erp:erp") |
|||
private String goalSource ; |
|||
|
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.lzbi.asset.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.lzbi.asset.domain.DcBusiWorkReadConfig; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 互联参数读取数据对照表;(dc_busi_work_read_config)表数据库访问层 |
|||
* @author : zhousq |
|||
* @date : 2023-11-30 |
|||
*/ |
|||
@InterceptorIgnore(tenantLine = "true") |
|||
public interface DcBusiWorkReadConfigMapper extends BaseMapper<DcBusiWorkReadConfig>{ |
|||
List<DcBusiWorkReadConfig> selectByVo( DcBusiWorkReadConfig beanVo); |
|||
int insertByVo( DcBusiWorkReadConfig beanVo); |
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.lzbi.asset.service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import com.lzbi.asset.mapper.DcBusiWorkReadConfigMapper; |
|||
import org.springframework.stereotype.Service; |
|||
import com.lzbi.asset.domain.DcBusiWorkReadConfig; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 互联参数读取数据对照表;(dc_busi_work_read_config)表服务接口 |
|||
* @author : zhousq |
|||
* @date : 2023-11-30 |
|||
*/ |
|||
@Service |
|||
public class DcBusiWorkReadConfigService extends ServiceImpl<DcBusiWorkReadConfigMapper, DcBusiWorkReadConfig> implements IService<DcBusiWorkReadConfig> { |
|||
|
|||
public List<DcBusiWorkReadConfig> selectByVo( DcBusiWorkReadConfig dcBusiWorkReadConfig){ |
|||
return baseMapper.selectByVo(dcBusiWorkReadConfig); |
|||
} |
|||
public int insertByVo( DcBusiWorkReadConfig dcBusiWorkReadConfig){ |
|||
return baseMapper.insertByVo(dcBusiWorkReadConfig); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,124 @@ |
|||
package com.lzbi.code.controller; |
|||
|
|||
import java.util.List; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
|
|||
import com.lzbi.code.domain.DcBusiCoderuleConfigDao; |
|||
import com.lzbi.code.service.CodeNoGenerater; |
|||
import com.lzbi.common.utils.StringUtils; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.PutMapping; |
|||
import org.springframework.web.bind.annotation.DeleteMapping; |
|||
import org.springframework.web.bind.annotation.PathVariable; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import com.lzbi.common.annotation.Log; |
|||
import com.lzbi.common.core.controller.BaseController; |
|||
import com.lzbi.common.core.domain.AjaxResult; |
|||
import com.lzbi.common.enums.BusinessType; |
|||
import com.lzbi.code.domain.DcBaseCoderuleDefineDao; |
|||
import com.lzbi.code.service.DcBaseCoderuleDefineService; |
|||
import com.lzbi.common.utils.poi.ExcelUtil; |
|||
import com.lzbi.common.core.page.TableDataInfo; |
|||
|
|||
/** |
|||
* 编码规则定义Controller |
|||
* |
|||
* @author win |
|||
* @date 2023-11-29 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/asset/codeDefine") |
|||
public class DcBaseCoderuleDefineController extends BaseController |
|||
{ |
|||
@Autowired |
|||
private DcBaseCoderuleDefineService dcBaseCoderuleDefineService; |
|||
@Autowired |
|||
private CodeNoGenerater codeNoGenerater; |
|||
/** |
|||
* 查询编码规则定义列表 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('asset:codeDefine:list')") |
|||
@GetMapping("/list") |
|||
public TableDataInfo list(DcBaseCoderuleDefineDao dcBaseCoderuleDefineDao) |
|||
{ |
|||
startPage(); |
|||
List<DcBaseCoderuleDefineDao> list = dcBaseCoderuleDefineService.selectDcBaseCoderuleDefineDaoList(dcBaseCoderuleDefineDao); |
|||
return getDataTable(list); |
|||
} |
|||
|
|||
/** |
|||
* 导出编码规则定义列表 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('asset:codeDefine:export')") |
|||
@Log(title = "编码规则定义", businessType = BusinessType.EXPORT) |
|||
@PostMapping("/export") |
|||
public void export(HttpServletResponse response, DcBaseCoderuleDefineDao dcBaseCoderuleDefineDao) |
|||
{ |
|||
List<DcBaseCoderuleDefineDao> list = dcBaseCoderuleDefineService.selectDcBaseCoderuleDefineDaoList(dcBaseCoderuleDefineDao); |
|||
ExcelUtil<DcBaseCoderuleDefineDao> util = new ExcelUtil<DcBaseCoderuleDefineDao>(DcBaseCoderuleDefineDao.class); |
|||
util.exportExcel(response, list, "编码规则定义数据"); |
|||
} |
|||
|
|||
/** |
|||
* 获取编码规则定义详细信息 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('asset:codeDefine:query')") |
|||
@GetMapping(value = "/{id}") |
|||
public AjaxResult getInfo(@PathVariable("id") Long id) |
|||
{ |
|||
return success(dcBaseCoderuleDefineService.selectDcBaseCoderuleDefineDaoById(id)); |
|||
} |
|||
|
|||
/** |
|||
* 新增编码规则定义 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('asset:codeDefine:add')") |
|||
@Log(title = "编码规则定义", businessType = BusinessType.INSERT) |
|||
@PostMapping |
|||
public AjaxResult add(@RequestBody DcBaseCoderuleDefineDao dcBaseCoderuleDefineDao) |
|||
{ |
|||
return toAjax(dcBaseCoderuleDefineService.insertDcBaseCoderuleDefineDao(dcBaseCoderuleDefineDao)); |
|||
} |
|||
|
|||
/** |
|||
* 修改编码规则定义 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('asset:codeDefine:edit')") |
|||
@Log(title = "编码规则定义", businessType = BusinessType.UPDATE) |
|||
@PutMapping |
|||
public AjaxResult edit(@RequestBody DcBaseCoderuleDefineDao dcBaseCoderuleDefineDao) |
|||
{ |
|||
return toAjax(dcBaseCoderuleDefineService.updateDcBaseCoderuleDefineDao(dcBaseCoderuleDefineDao)); |
|||
} |
|||
|
|||
/** |
|||
* 删除编码规则定义 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('asset:codeDefine:remove')") |
|||
@Log(title = "编码规则定义", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/{ids}") |
|||
public AjaxResult remove(@PathVariable Long[] ids) |
|||
{ |
|||
return toAjax(dcBaseCoderuleDefineService.deleteDcBaseCoderuleDefineDaoByIds(ids)); |
|||
} |
|||
@GetMapping(value = "/coder/{busiCode}") |
|||
public AjaxResult getInfo(@PathVariable("busiCode") String busiCode) |
|||
{ |
|||
//根据业务编码获取规则定义
|
|||
DcBusiCoderuleConfigDao ruleIdByBusicode = dcBaseCoderuleDefineService.getRuleIdByBusicode(busiCode); |
|||
DcBaseCoderuleDefineDao ruleDao = dcBaseCoderuleDefineService.selectDcBaseCoderuleDefineDaoById(ruleIdByBusicode.getRuleId()); |
|||
String code=codeNoGenerater.getCode(ruleDao); |
|||
//解析规则,获取编码
|
|||
if(StringUtils.isNull(code)){ |
|||
return AjaxResult.error("获取编码失败!请确认配置或者稍后重试!"); |
|||
} |
|||
return AjaxResult.success(code); |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,51 @@ |
|||
package com.lzbi.code.domain; |
|||
|
|||
import java.util.Date; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import org.apache.commons.lang3.builder.ToStringBuilder; |
|||
import org.apache.commons.lang3.builder.ToStringStyle; |
|||
import lombok.Data; |
|||
import com.lzbi.common.annotation.Excel; |
|||
import com.lzbi.module.base.BaseModuleEntity; |
|||
|
|||
/** |
|||
* 编码规则定义对象 dc_base_coderule_define |
|||
* |
|||
* @author win |
|||
* @date 2023-11-29 |
|||
*/ |
|||
@Data |
|||
public class DcBaseCoderuleDefineDao extends BaseModuleEntity |
|||
{ |
|||
private static final long serialVersionUID = 1L; |
|||
/** 配置ID */ |
|||
private Long id; |
|||
/** */ |
|||
private Long deptId; |
|||
/** 配置名称 */ |
|||
@Excel(name = "配置名称") |
|||
private String codeConfigName; |
|||
|
|||
/** 编码头名称 */ |
|||
@Excel(name = "编码头名称") |
|||
private String codeHeader; |
|||
|
|||
/** 编码体 */ |
|||
@Excel(name = "编码体") |
|||
private String codeBody; |
|||
|
|||
/** 编码体类型 */ |
|||
@Excel(name = "编码体类型") |
|||
private String codeBodyType; |
|||
|
|||
/** 流水号长度 */ |
|||
@Excel(name = "流水号长度") |
|||
private Long codeSerialLength; |
|||
|
|||
/** 分割符 */ |
|||
@Excel(name = "分割符") |
|||
private String codeSplitFlag; |
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,38 @@ |
|||
package com.lzbi.code.domain; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import java.util.Date; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
import lombok.experimental.Accessors; |
|||
import com.lzbi.module.base.BaseModuleEntity; |
|||
|
|||
/** |
|||
* 编码规则流水号表; |
|||
* @author : zhousq |
|||
* @date : 2023-11-29 |
|||
*/ |
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
@Accessors(chain = true) |
|||
@ApiModel(value = "编码规则流水号表",description = "") |
|||
@TableName("dc_base_coderule_serial") |
|||
public class DcBaseCoderuleSerialDao extends BaseModuleEntity{ |
|||
|
|||
/** 主键 */ |
|||
@ApiModelProperty(name = "主键",notes = "") |
|||
@TableId |
|||
private Integer id ; |
|||
/** 规则定义的ID */ |
|||
@ApiModelProperty(name = "规则定义的ID",notes = "") |
|||
private Long codeRuleId ; |
|||
/** 流水号 */ |
|||
@ApiModelProperty(name = "流水号",notes = "") |
|||
private Long serialId ; |
|||
|
|||
} |
@ -0,0 +1,44 @@ |
|||
package com.lzbi.code.domain; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import java.util.Date; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
import lombok.experimental.Accessors; |
|||
import com.lzbi.module.base.BaseModuleEntity; |
|||
|
|||
/** |
|||
* 业务编码规则配置; |
|||
* @author : zhousq |
|||
* @date : 2023-11-29 |
|||
*/ |
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
@Accessors(chain = true) |
|||
@ApiModel(value = "业务编码规则配置",description = "") |
|||
@TableName("dc_busi_coderule_config") |
|||
public class DcBusiCoderuleConfigDao extends BaseModuleEntity{ |
|||
|
|||
/** 主键 */ |
|||
@ApiModelProperty(name = "主键",notes = "") |
|||
@TableId |
|||
private Integer id ; |
|||
/** 规则名称 */ |
|||
@ApiModelProperty(name = "规则名称",notes = "") |
|||
private String configName ; |
|||
/** 业务代码 */ |
|||
@ApiModelProperty(name = "业务代码",notes = "") |
|||
private String nodeCode ; |
|||
/** 字段名称 */ |
|||
@ApiModelProperty(name = "字段名称",notes = "") |
|||
private String columnName ; |
|||
/** 规则ID */ |
|||
@ApiModelProperty(name = "规则ID",notes = "") |
|||
private Long ruleId ; |
|||
|
|||
} |
@ -0,0 +1,40 @@ |
|||
package com.lzbi.code.domain; |
|||
|
|||
/** |
|||
* 业务操作类型 |
|||
* |
|||
* @author ruoyi |
|||
*/ |
|||
public enum codeBodyType |
|||
{ |
|||
/** |
|||
* 日期类型 |
|||
*/ |
|||
DATETYPE("dateType"), |
|||
|
|||
/** |
|||
* 用户定义 |
|||
*/ |
|||
USERDEFINE("userDefine"), |
|||
|
|||
/** |
|||
* 不设置 |
|||
*/ |
|||
NOBODY("noBody"), |
|||
|
|||
/** |
|||
* 部门编码默认四位+ |
|||
*/ |
|||
DEPTCODE("deptCode"), |
|||
; |
|||
private final String type; |
|||
codeBodyType (String type){ |
|||
this.type=type; |
|||
} |
|||
@Override |
|||
public String toString(){ |
|||
return this.type; |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,69 @@ |
|||
package com.lzbi.code.mapper; |
|||
|
|||
import java.util.List; |
|||
import com.lzbi.code.domain.DcBaseCoderuleDefineDao; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.lzbi.code.domain.DcBaseCoderuleSerialDao; |
|||
import com.lzbi.code.domain.DcBusiCoderuleConfigDao; |
|||
|
|||
/** |
|||
* 编码规则定义Mapper接口 |
|||
* |
|||
* @author win |
|||
* @date 2023-11-29 |
|||
*/ |
|||
|
|||
public interface DcBaseCoderuleDefineMapper extends BaseMapper<DcBaseCoderuleDefineDao> |
|||
{ |
|||
/** |
|||
* 查询编码规则定义 |
|||
* |
|||
* @param id 编码规则定义主键 |
|||
* @return 编码规则定义 |
|||
*/ |
|||
public DcBaseCoderuleDefineDao selectDcBaseCoderuleDefineDaoById(Long id); |
|||
|
|||
/** |
|||
* 查询编码规则定义列表 |
|||
* |
|||
* @param dcBaseCoderuleDefineDao 编码规则定义 |
|||
* @return 编码规则定义集合 |
|||
*/ |
|||
public List<DcBaseCoderuleDefineDao> selectDcBaseCoderuleDefineDaoList(DcBaseCoderuleDefineDao dcBaseCoderuleDefineDao); |
|||
|
|||
/** |
|||
* 新增编码规则定义 |
|||
* |
|||
* @param dcBaseCoderuleDefineDao 编码规则定义 |
|||
* @return 结果 |
|||
*/ |
|||
public int insertDcBaseCoderuleDefineDao(DcBaseCoderuleDefineDao dcBaseCoderuleDefineDao); |
|||
|
|||
/** |
|||
* 修改编码规则定义 |
|||
* |
|||
* @param dcBaseCoderuleDefineDao 编码规则定义 |
|||
* @return 结果 |
|||
*/ |
|||
public int updateDcBaseCoderuleDefineDao(DcBaseCoderuleDefineDao dcBaseCoderuleDefineDao); |
|||
|
|||
/** |
|||
* 删除编码规则定义 |
|||
* |
|||
* @param id 编码规则定义主键 |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteDcBaseCoderuleDefineDaoById(Long id); |
|||
|
|||
/** |
|||
* 批量删除编码规则定义 |
|||
* |
|||
* @param ids 需要删除的数据主键集合 |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteDcBaseCoderuleDefineDaoByIds(Long[] ids); |
|||
|
|||
public DcBaseCoderuleSerialDao getSerialByRuleId(Long rid); |
|||
public int updateSerial(long revision ,long serial,long id); |
|||
public DcBusiCoderuleConfigDao getRuleIdByBusicode(String busiCode); |
|||
} |
@ -0,0 +1,86 @@ |
|||
package com.lzbi.code.service; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import com.lzbi.code.domain.DcBaseCoderuleDefineDao; |
|||
import com.lzbi.code.domain.DcBaseCoderuleSerialDao; |
|||
import com.lzbi.code.domain.codeBodyType; |
|||
import com.lzbi.common.utils.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.Optional; |
|||
|
|||
/** |
|||
* @auth create by Administrator |
|||
* @date 2023/11/30 |
|||
* CodeNoGenerater |
|||
*/ |
|||
@Service |
|||
public class CodeNoGenerater { |
|||
@Autowired |
|||
DcBaseCoderuleDefineService dcBaseCoderuleDefineService; |
|||
/** |
|||
* 根据规则获取编码 |
|||
* */ |
|||
public String getCode(DcBaseCoderuleDefineDao ruleDao){ |
|||
if(StringUtils.isNull(ruleDao)){ |
|||
return null; |
|||
}else{ |
|||
|
|||
String serial=getSerial(ruleDao.getId()); |
|||
if(StringUtils.isNull(serial)){ |
|||
return null; |
|||
} |
|||
int serialLen=ruleDao.getCodeSerialLength().intValue(); |
|||
StringBuilder codeBuffer=new StringBuilder(); |
|||
//
|
|||
String spitChar= Optional.ofNullable(ruleDao.getCodeSplitFlag()).orElse(""); |
|||
codeBuffer.append(ruleDao.getCodeHeader()).append(spitChar).append(getBody(ruleDao)).append(spitChar).append(StringUtils.leftPad(serial,serialLen,'0')); |
|||
return codeBuffer.toString(); |
|||
} |
|||
|
|||
} |
|||
private String getBody(DcBaseCoderuleDefineDao ruleDao){ |
|||
if (ruleDao.getCodeBodyType().equals(codeBodyType.USERDEFINE.toString())){ |
|||
return Optional.ofNullable(ruleDao.getCodeBodyType()).orElse(""); |
|||
} |
|||
if (ruleDao.getCodeBodyType().equals(codeBodyType.NOBODY.toString())){ |
|||
return ""; |
|||
} |
|||
if (ruleDao.getCodeBodyType().equals(codeBodyType.DEPTCODE.toString())){ |
|||
return StringUtils.leftPad(String.valueOf(ruleDao.getDeptId()) ,4,"0"); |
|||
} |
|||
if (ruleDao.getCodeBodyType().equals(codeBodyType.DATETYPE.toString())){ |
|||
String df=Optional.ofNullable(ruleDao.getCodeBody()).orElse("yyyyMMdd"); |
|||
return DateUtil.format(DateUtil.date(),df); |
|||
} |
|||
return ""; |
|||
} |
|||
private String getSerial(long rid){ |
|||
DcBaseCoderuleSerialDao serialByRuleId = dcBaseCoderuleDefineService.getSerialByRuleId(rid); |
|||
if(dcBaseCoderuleDefineService.updateSerial(serialByRuleId.getRevision(),serialByRuleId.getSerialId()+1,serialByRuleId.getId())>0){ |
|||
return String.valueOf(serialByRuleId.getSerialId()+1); |
|||
}else{ |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
// public String getAssetCode(DcBaseCoderuleDefineDao ruleDao){
|
|||
// if(StringUtils.isNull(ruleDao)){
|
|||
// return null;
|
|||
// }else{
|
|||
//
|
|||
// String serial=getSerial(ruleDao.getId());
|
|||
// if(StringUtils.isNull(serial)){
|
|||
// return null;
|
|||
// }
|
|||
// int serialLen=ruleDao.getCodeSerialLength().intValue();
|
|||
// StringBuilder codeBuffer=new StringBuilder();
|
|||
// //
|
|||
// String spitChar= Optional.ofNullable(ruleDao.getCodeSplitFlag()).orElse("");
|
|||
// codeBuffer.append(ruleDao.getCodeHeader()).append(spitChar).append(getBody(ruleDao)).append(spitChar).append(StringUtils.leftPad(serial,serialLen,'0'));
|
|||
// return codeBuffer.toString();
|
|||
// }
|
|||
//
|
|||
// }
|
|||
} |
@ -0,0 +1,109 @@ |
|||
package com.lzbi.code.service; |
|||
|
|||
import java.util.List; |
|||
import java.util.Optional; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.lzbi.code.domain.DcBaseCoderuleSerialDao; |
|||
import com.lzbi.code.domain.DcBusiCoderuleConfigDao; |
|||
import com.lzbi.code.domain.codeBodyType; |
|||
import com.lzbi.common.utils.DateUtils; |
|||
import com.lzbi.common.utils.StringUtils; |
|||
import org.springframework.stereotype.Service; |
|||
import com.lzbi.code.domain.DcBaseCoderuleDefineDao; |
|||
import com.lzbi.code.mapper.DcBaseCoderuleDefineMapper; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
/** |
|||
* 编码规则定义Service业务层处理 |
|||
* |
|||
* @author win |
|||
* @date 2023-11-29 |
|||
*/ |
|||
@Service |
|||
public class DcBaseCoderuleDefineService extends ServiceImpl<DcBaseCoderuleDefineMapper, DcBaseCoderuleDefineDao> implements IService<DcBaseCoderuleDefineDao> |
|||
{ |
|||
|
|||
/** |
|||
* 查询编码规则定义 |
|||
* |
|||
* @param id 编码规则定义主键 |
|||
* @return 编码规则定义 |
|||
*/ |
|||
public DcBaseCoderuleDefineDao selectDcBaseCoderuleDefineDaoById(Long id) |
|||
{ |
|||
return baseMapper.selectDcBaseCoderuleDefineDaoById(id); |
|||
} |
|||
|
|||
/** |
|||
* 查询编码规则定义列表 |
|||
* |
|||
* @param dcBaseCoderuleDefineDao 编码规则定义 |
|||
* @return 编码规则定义 |
|||
*/ |
|||
public List<DcBaseCoderuleDefineDao> selectDcBaseCoderuleDefineDaoList(DcBaseCoderuleDefineDao dcBaseCoderuleDefineDao) |
|||
{ |
|||
return baseMapper.selectDcBaseCoderuleDefineDaoList(dcBaseCoderuleDefineDao); |
|||
} |
|||
|
|||
/** |
|||
* 新增编码规则定义 |
|||
* |
|||
* @param dcBaseCoderuleDefineDao 编码规则定义 |
|||
* @return 结果 |
|||
*/ |
|||
|
|||
public int insertDcBaseCoderuleDefineDao(DcBaseCoderuleDefineDao dcBaseCoderuleDefineDao) |
|||
{ |
|||
dcBaseCoderuleDefineDao.setCreatedTime(DateUtils.getNowDate()); |
|||
return baseMapper.insertDcBaseCoderuleDefineDao(dcBaseCoderuleDefineDao); |
|||
} |
|||
|
|||
/** |
|||
* 修改编码规则定义 |
|||
* |
|||
* @param dcBaseCoderuleDefineDao 编码规则定义 |
|||
* @return 结果 |
|||
*/ |
|||
|
|||
public int updateDcBaseCoderuleDefineDao(DcBaseCoderuleDefineDao dcBaseCoderuleDefineDao) |
|||
{ |
|||
dcBaseCoderuleDefineDao.setUpdatedTime(DateUtils.getNowDate()); |
|||
return baseMapper.updateDcBaseCoderuleDefineDao(dcBaseCoderuleDefineDao); |
|||
} |
|||
|
|||
/** |
|||
* 批量删除编码规则定义 |
|||
* |
|||
* @param ids 需要删除的编码规则定义主键 |
|||
* @return 结果 |
|||
*/ |
|||
|
|||
public int deleteDcBaseCoderuleDefineDaoByIds(Long[] ids) |
|||
{ |
|||
return baseMapper.deleteDcBaseCoderuleDefineDaoByIds(ids); |
|||
} |
|||
|
|||
/** |
|||
* 删除编码规则定义信息 |
|||
* |
|||
* @param id 编码规则定义主键 |
|||
* @return 结果 |
|||
*/ |
|||
|
|||
public int deleteDcBaseCoderuleDefineDaoById(Long id) |
|||
{ |
|||
return baseMapper.deleteDcBaseCoderuleDefineDaoById(id); |
|||
} |
|||
public DcBaseCoderuleSerialDao getSerialByRuleId(Long rid){ |
|||
return baseMapper.getSerialByRuleId(rid); |
|||
} |
|||
public int updateSerial(long revision ,long serial,long id){ |
|||
return baseMapper.updateSerial(revision ,serial,id); |
|||
} |
|||
public DcBusiCoderuleConfigDao getRuleIdByBusicode(String busiCode){ |
|||
return baseMapper.getRuleIdByBusicode(busiCode); |
|||
} |
|||
|
|||
} |
@ -1,102 +0,0 @@ |
|||
package com.lzbi.serial.controller; |
|||
|
|||
|
|||
import javax.servlet.http.HttpServletResponse; |
|||
|
|||
|
|||
import com.lzbi.common.core.controller.BaseController; |
|||
import com.lzbi.common.core.domain.AjaxResult; |
|||
import com.lzbi.common.core.page.TableDataInfo; |
|||
import com.lzbi.common.utils.poi.ExcelUtil; |
|||
import com.lzbi.serial.domain.CodeRuleDefine; |
|||
import com.lzbi.serial.service.CodeRuleDefineService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.PutMapping; |
|||
import org.springframework.web.bind.annotation.DeleteMapping; |
|||
import org.springframework.web.bind.annotation.PathVariable; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.List; |
|||
|
|||
|
|||
/** |
|||
* 单据编号定定义Controller |
|||
* |
|||
* @author ruoyi |
|||
* @date 2022-12-20 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/codeRule/define") |
|||
public class CodeRuleDefineController extends BaseController |
|||
{ |
|||
@Autowired |
|||
private CodeRuleDefineService codeRuleDefineService; |
|||
|
|||
/** |
|||
* 查询单据编号定定义列表 |
|||
*/ |
|||
|
|||
@GetMapping("/list") |
|||
public TableDataInfo list(CodeRuleDefine sysBillnoDefine) |
|||
{ |
|||
startPage(); |
|||
List<CodeRuleDefine> list = codeRuleDefineService.selectCodeRuleDefineList(sysBillnoDefine); |
|||
return getDataTable(list); |
|||
} |
|||
|
|||
/** |
|||
* 导出单据编号定定义列表 |
|||
*/ |
|||
|
|||
@PostMapping("/export") |
|||
public void export(HttpServletResponse response, CodeRuleDefine sysBillnoDefine) |
|||
{ |
|||
List<CodeRuleDefine> list = codeRuleDefineService.selectCodeRuleDefineList(sysBillnoDefine); |
|||
ExcelUtil<CodeRuleDefine> util = new ExcelUtil<CodeRuleDefine>(CodeRuleDefine.class); |
|||
util.exportExcel(response, list, "单据编号定定义数据"); |
|||
} |
|||
|
|||
/** |
|||
* 获取单据编号定定义详细信息 |
|||
*/ |
|||
|
|||
@GetMapping(value = "/{defineId}") |
|||
public AjaxResult getInfo(@PathVariable("defineId") Long defineId) |
|||
{ |
|||
return success(codeRuleDefineService.selectCodeRuleDefineByDefineId(defineId)); |
|||
} |
|||
|
|||
/** |
|||
* 新增单据编号定定义 |
|||
*/ |
|||
|
|||
@PostMapping |
|||
public AjaxResult add(@RequestBody CodeRuleDefine sysBillnoDefine) |
|||
{ |
|||
return toAjax(codeRuleDefineService.insertCodeRuleDefine(sysBillnoDefine)); |
|||
} |
|||
|
|||
/** |
|||
* 修改单据编号定定义 |
|||
*/ |
|||
|
|||
@PutMapping |
|||
public AjaxResult edit(@RequestBody CodeRuleDefine sysBillnoDefine) |
|||
{ |
|||
return toAjax(codeRuleDefineService.updateCodeRuleDefine(sysBillnoDefine)); |
|||
} |
|||
|
|||
/** |
|||
* 删除单据编号定定义 |
|||
*/ |
|||
|
|||
@DeleteMapping("/{defineIds}") |
|||
public AjaxResult remove(@PathVariable Long[] defineIds) |
|||
{ |
|||
return toAjax(codeRuleDefineService.deleteCodeRuleDefineByDefineIds(defineIds)); |
|||
} |
|||
} |
@ -1,138 +0,0 @@ |
|||
package com.lzbi.serial.controller; |
|||
|
|||
|
|||
import com.lzbi.common.core.controller.BaseController; |
|||
import com.lzbi.common.core.domain.AjaxResult; |
|||
import com.lzbi.common.core.domain.entity.SysUser; |
|||
import com.lzbi.common.core.domain.model.LoginUser; |
|||
import com.lzbi.common.core.page.TableDataInfo; |
|||
import com.lzbi.common.utils.DateUtils; |
|||
import com.lzbi.common.utils.SecurityUtils; |
|||
import com.lzbi.common.utils.StringUtils; |
|||
import com.lzbi.serial.domain.CodeRuleDefine; |
|||
import com.lzbi.serial.domain.CodeRuleSerial; |
|||
import com.lzbi.serial.service.CodeRuleDefineService; |
|||
import com.lzbi.serial.service.CodeRuleSerialService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 单据流水号Controller |
|||
* |
|||
* @author ruoyi |
|||
* @date 2022-12-20 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/codeRule/serial") |
|||
public class CodeRuleSerialController extends BaseController { |
|||
@Autowired |
|||
private CodeRuleSerialService codeRuleSerialService; |
|||
@Autowired |
|||
private CodeRuleDefineService codeRuleDefineService; |
|||
/** |
|||
* 查询单据流水号列表 |
|||
*/ |
|||
@GetMapping("/list") |
|||
public TableDataInfo list(CodeRuleSerial codeRuleSerial) { |
|||
startPage(); |
|||
List<CodeRuleSerial> list = codeRuleSerialService.selectCodeRuleSerialList(codeRuleSerial); |
|||
return getDataTable(list); |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 获取单据流水号详细信息 |
|||
*/ |
|||
|
|||
@GetMapping(value = "/{id}") |
|||
public AjaxResult getInfo(@PathVariable("id") Long id) { |
|||
return success(codeRuleSerialService.selectCodeRuleSerialById(id)); |
|||
} |
|||
|
|||
/** |
|||
* 新增单据流水号 |
|||
*/ |
|||
|
|||
@PostMapping |
|||
public AjaxResult add(@RequestBody CodeRuleSerial codeRuleSerial) { |
|||
return toAjax(codeRuleSerialService.insertCodeRuleSerial(codeRuleSerial)); |
|||
} |
|||
|
|||
/** |
|||
* 修改单据流水号 |
|||
*/ |
|||
|
|||
@PutMapping |
|||
public AjaxResult edit(@RequestBody CodeRuleSerial codeRuleSerial) { |
|||
return toAjax(codeRuleSerialService.updateCodeRuleSerial(codeRuleSerial)); |
|||
} |
|||
|
|||
/** |
|||
* 删除单据流水号 |
|||
*/ |
|||
|
|||
@DeleteMapping("/{ids}") |
|||
public AjaxResult remove(@PathVariable Long[] ids) { |
|||
return toAjax(codeRuleSerialService.deleteCodeRuleSerialByIds(ids)); |
|||
} |
|||
|
|||
/** |
|||
* addby zhousq 获取单据流水号 |
|||
* 根据单据的ID获取单据header |
|||
* 通过headerYYYYMMDD 获取当日流水号 查询无记录需要新增一条,有记录需要先进行更新流水号成功后返回,否则失败 |
|||
* 2023-1-16 增加动态配置能力,可以在数据库配置 格式、长度 |
|||
* 原有方法作废 |
|||
*/ |
|||
|
|||
@GetMapping("/getBillNo/{node}") |
|||
public AjaxResult getBillNo(@PathVariable String node) { |
|||
String billNo = ""; |
|||
long serialsize = 4; |
|||
//
|
|||
CodeRuleDefine codeRuleDefine = codeRuleDefineService.selectCodeRuleDefineByDefineId(0L); |
|||
if (codeRuleDefine.getDefHeader().isEmpty()) { |
|||
return AjaxResult.error("没有定义过ID为" + String.valueOf(0) + "的编号规则类型!"); |
|||
} |
|||
billNo = codeRuleDefine.getDefHeader() + DateUtils.dateTimeNow(codeRuleDefine.getDefHeaderType()); |
|||
serialsize=codeRuleDefine.getSerialLength(); |
|||
CodeRuleSerial codeRuleSerial = codeRuleSerialService.selectCodeRuleSerialByHeader(billNo); |
|||
SysUser sysUser = SecurityUtils.getLoginUser().getUser(); |
|||
if (null== codeRuleSerial || null == codeRuleSerial.getHeaderBillno()) { |
|||
codeRuleSerial=new CodeRuleSerial(); |
|||
codeRuleSerial.setHeaderBillno(billNo); |
|||
codeRuleSerial.setLockSerial(1L); |
|||
codeRuleSerial.setSerialNo(1L); |
|||
codeRuleSerial.setCreatedTime(DateUtils.getNowDate()); |
|||
codeRuleSerial.setCreatedBy(sysUser.getUserName()); |
|||
codeRuleSerial.setUpdatedBy(sysUser.getUserName()); |
|||
codeRuleSerial.setUpdatedTime(DateUtils.getNowDate()); |
|||
int ret = codeRuleSerialService.insertCodeRuleSerial(codeRuleSerial); |
|||
if (ret > 0) { |
|||
return AjaxResult.success("获取规则编号成功",billNo + StringUtils.padl(1L, (int)serialsize)); |
|||
} else { |
|||
return AjaxResult.error("新建规则编号失败!"); |
|||
} |
|||
|
|||
} else { |
|||
long serialnum = codeRuleSerial.getSerialNo(); |
|||
codeRuleSerial.setSerialNo(serialnum + 1L); |
|||
codeRuleSerial.setLockSerial(serialnum); |
|||
codeRuleSerial.setUpdatedBy(sysUser.getUserName()); |
|||
codeRuleSerial.setUpdatedTime(DateUtils.getNowDate()); |
|||
int ret = codeRuleSerialService.updateCodeRuleSerialLock(codeRuleSerial); |
|||
if (ret > 0) { |
|||
|
|||
return AjaxResult.success("ok",billNo + StringUtils.padl(codeRuleSerial.getSerialNo(), (int)serialsize)); |
|||
} else { |
|||
return AjaxResult.error("新建规则编号失败!请稍后重试"); |
|||
} |
|||
|
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
} |
@ -1,52 +0,0 @@ |
|||
package com.lzbi.serial.domain; |
|||
|
|||
import com.lzbi.module.base.BaseModuleEntity; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
import org.apache.commons.lang3.builder.ToStringBuilder; |
|||
import org.apache.commons.lang3.builder.ToStringStyle; |
|||
|
|||
|
|||
/** |
|||
* 单据编号定定义对象 sys_billno_define |
|||
* |
|||
* @author ruoyi |
|||
* @date 2022-12-20 |
|||
*/ |
|||
@Data |
|||
@ApiModel("编码规则定义") |
|||
public class CodeRuleDefine extends BaseModuleEntity |
|||
{ |
|||
private static final long serialVersionUID = 1L; |
|||
@ApiModelProperty("编码规则ID") |
|||
/** 定义ID唯一 */ |
|||
private Long defineId; |
|||
|
|||
/** 单据开头名称 */ |
|||
@ApiModelProperty("编码规则头") |
|||
private String defHeader; |
|||
/** 单据类型 */ |
|||
@ApiModelProperty("编码规则类型") |
|||
private String defClass; |
|||
/** 所属部门id */ |
|||
@ApiModelProperty("编码规则头") |
|||
private Long deptId; |
|||
@ApiModelProperty("编码规则头") |
|||
private String defHeaderType; |
|||
@ApiModelProperty("编码规则头") |
|||
private Long serialLength; |
|||
|
|||
|
|||
@Override |
|||
public String toString() { |
|||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
|||
.append("defineId", getDefineId()) |
|||
.append("defHeader", getDefHeader()) |
|||
.append("defClass", getDefClass()) |
|||
.append("deptId", getDeptId()) |
|||
.append("defHeaderType", getDefHeaderType()) |
|||
.append("serialLength", getSerialLength()) |
|||
.toString(); |
|||
} |
|||
} |
@ -1,48 +0,0 @@ |
|||
package com.lzbi.serial.domain; |
|||
|
|||
import com.lzbi.module.base.BaseModuleEntity; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
import org.apache.commons.lang3.builder.ToStringBuilder; |
|||
import org.apache.commons.lang3.builder.ToStringStyle; |
|||
|
|||
|
|||
/** |
|||
* 单据流水号对象 sys_billno_serial |
|||
* |
|||
* @author ruoyi |
|||
* @date 2022-12-20 |
|||
*/ |
|||
@Data |
|||
@ApiModel("") |
|||
public class CodeRuleSerial extends BaseModuleEntity |
|||
{ |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** 唯一标识符 */ |
|||
private Long id; |
|||
|
|||
/** 单据开头名称+YYYYMMDD */ |
|||
@ApiModelProperty("单据开头名称") |
|||
private String headerBillno; |
|||
|
|||
/** 版本锁 */ |
|||
@ApiModelProperty("版本锁") |
|||
private Long lockSerial; |
|||
|
|||
/** 流水号 */ |
|||
@ApiModelProperty("流水号") |
|||
private Long serialNo; |
|||
|
|||
|
|||
@Override |
|||
public String toString() { |
|||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
|||
.append("id", getId()) |
|||
.append("headerBillno", getHeaderBillno()) |
|||
.append("lockSerial", getLockSerial()) |
|||
.append("serialNo", getSerialNo()) |
|||
.toString(); |
|||
} |
|||
} |
@ -1,66 +0,0 @@ |
|||
package com.lzbi.serial.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.lzbi.bi.domain.DcBusiDataScreenDto; |
|||
import com.lzbi.serial.domain.CodeRuleDefine; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 单据编号定定义Mapper接口 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2022-12-20 |
|||
*/ |
|||
@InterceptorIgnore(tenantLine = "true") |
|||
public interface CodeRuleDefineMapper extends BaseMapper<CodeRuleDefine> |
|||
{ |
|||
/** |
|||
* 查询单据编号定定义 |
|||
* |
|||
* @param defineId 单据编号定定义主键 |
|||
* @return 单据编号定定义 |
|||
*/ |
|||
public CodeRuleDefine selectCodeRuleDefineByDefineId(Long defineId); |
|||
|
|||
/** |
|||
* 查询单据编号定定义列表 |
|||
* |
|||
* @param |
|||
* @return 单据编号定定义集合 |
|||
*/ |
|||
public List<CodeRuleDefine> selectCodeRuleDefineList(CodeRuleDefine codeRuleDefine); |
|||
|
|||
/** |
|||
* 新增单据编号定定义 |
|||
* |
|||
* @param |
|||
* @return 结果 |
|||
*/ |
|||
public int insertCodeRuleDefine(CodeRuleDefine codeRuleDefine); |
|||
|
|||
/** |
|||
* 修改单据编号定定义 |
|||
* |
|||
* @param |
|||
* @return 结果 |
|||
*/ |
|||
public int updateCodeRuleDefine(CodeRuleDefine codeRuleDefine); |
|||
|
|||
/** |
|||
* 删除单据编号定定义 |
|||
* |
|||
* @param defineId 单据编号定定义主键 |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteCodeRuleDefineByDefineId(Long defineId); |
|||
|
|||
/** |
|||
* 批量删除单据编号定定义 |
|||
* |
|||
* @param defineIds 需要删除的数据主键集合 |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteCodeRuleDefineByDefineIds(Long[] defineIds); |
|||
} |
@ -1,77 +0,0 @@ |
|||
package com.lzbi.serial.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.lzbi.serial.domain.CodeRuleDefine; |
|||
import com.lzbi.serial.domain.CodeRuleSerial; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 单据流水号Mapper接口 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2022-12-20 |
|||
*/ |
|||
@InterceptorIgnore(tenantLine = "true") |
|||
public interface CodeRuleSerialMapper extends BaseMapper<CodeRuleSerial> |
|||
{ |
|||
/** |
|||
* 查询单据流水号 |
|||
* |
|||
* @param id 单据流水号主键 |
|||
* @return 单据流水号 |
|||
*/ |
|||
public CodeRuleSerial selectCodeRuleSerialById(Long id); |
|||
|
|||
/** |
|||
* 查询单据流水号列表 |
|||
* |
|||
* @param |
|||
* @return 单据流水号集合 |
|||
*/ |
|||
public List<CodeRuleSerial> selectCodeRuleSerialList(CodeRuleSerial codeRuleSerial); |
|||
|
|||
/** |
|||
* 新增单据流水号 |
|||
* |
|||
* @param |
|||
* @return 结果 |
|||
*/ |
|||
public int insertCodeRuleSerial(CodeRuleSerial codeRuleSerial); |
|||
|
|||
/** |
|||
* 修改单据流水号 |
|||
* |
|||
* @param |
|||
* @return 结果 |
|||
*/ |
|||
public int updateCodeRuleSerial(CodeRuleSerial codeRuleSerial); |
|||
|
|||
/** |
|||
* 删除单据流水号 |
|||
* |
|||
* @param id 单据流水号主键 |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteCodeRuleSerialById(Long id); |
|||
|
|||
/** |
|||
* 批量删除单据流水号 |
|||
* |
|||
* @param ids 需要删除的数据主键集合 |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteCodeRuleSerialByIds(Long[] ids); |
|||
|
|||
|
|||
public CodeRuleSerial selectCodeRuleSerialByHeader(String headerBillno); |
|||
/** |
|||
* 成功获取完成流水号获取为1,失败为0 |
|||
* |
|||
* @param svo 必须包含参数 header 单据头 serialno |
|||
* @return 单据流水号 |
|||
*/ |
|||
|
|||
public int updateCodeRuleSerialLock(CodeRuleSerial svo); |
|||
} |
@ -1,105 +0,0 @@ |
|||
package com.lzbi.serial.service; |
|||
|
|||
|
|||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import com.lzbi.common.core.domain.model.LoginUser; |
|||
import com.lzbi.common.utils.DateUtils; |
|||
import com.lzbi.common.utils.SecurityUtils; |
|||
import com.lzbi.serial.domain.CodeRuleDefine; |
|||
import com.lzbi.serial.mapper.CodeRuleDefineMapper; |
|||
|
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 单据编号定定义Service业务层处理 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2022-12-20 |
|||
*/ |
|||
|
|||
@Service |
|||
public class CodeRuleDefineService extends ServiceImpl<CodeRuleDefineMapper, CodeRuleDefine> implements IService<CodeRuleDefine> |
|||
{ |
|||
|
|||
|
|||
/** |
|||
* 查询单据编号定定义 |
|||
* |
|||
* @param defineId 单据编号定定义主键 |
|||
* @return 单据编号定定义 |
|||
*/ |
|||
|
|||
public CodeRuleDefine selectCodeRuleDefineByDefineId(Long defineId) |
|||
{ |
|||
return baseMapper.selectCodeRuleDefineByDefineId(defineId); |
|||
} |
|||
|
|||
/** |
|||
* 查询单据编号定定义列表 |
|||
* |
|||
* @param codeRuleDefine 单据编号定定义 |
|||
* @return 单据编号定定义 |
|||
*/ |
|||
|
|||
public List<CodeRuleDefine> selectCodeRuleDefineList(CodeRuleDefine codeRuleDefine) |
|||
{ |
|||
return baseMapper.selectCodeRuleDefineList(codeRuleDefine); |
|||
} |
|||
|
|||
/** |
|||
* 新增单据编号定定义 |
|||
* |
|||
* @param codeRuleDefine 单据编号定定义 |
|||
* @return 结果 |
|||
*/ |
|||
|
|||
public int insertCodeRuleDefine(CodeRuleDefine codeRuleDefine) |
|||
{ |
|||
LoginUser loginUser= SecurityUtils.getLoginUser(); |
|||
codeRuleDefine.setCreatedBy(loginUser.getUsername()); |
|||
codeRuleDefine.setCreatedTime(DateUtils.getNowDate()); |
|||
codeRuleDefine.setDeptId(loginUser.getDeptId()); |
|||
return baseMapper.insertCodeRuleDefine(codeRuleDefine); |
|||
} |
|||
|
|||
/** |
|||
* 修改单据编号定定义 |
|||
* |
|||
* @param codeRuleDefine 单据编号定定义 |
|||
* @return 结果 |
|||
*/ |
|||
|
|||
public int updateCodeRuleDefine(CodeRuleDefine codeRuleDefine) |
|||
{ |
|||
codeRuleDefine.setUpdatedTime(DateUtils.getNowDate()); |
|||
return baseMapper.updateCodeRuleDefine(codeRuleDefine); |
|||
} |
|||
|
|||
/** |
|||
* 批量删除单据编号定定义 |
|||
* |
|||
* @param defineIds 需要删除的单据编号定定义主键 |
|||
* @return 结果 |
|||
*/ |
|||
|
|||
public int deleteCodeRuleDefineByDefineIds(Long[] defineIds) |
|||
{ |
|||
return baseMapper.deleteCodeRuleDefineByDefineIds(defineIds); |
|||
} |
|||
|
|||
/** |
|||
* 删除单据编号定定义信息 |
|||
* |
|||
* @param defineId 单据编号定定义主键 |
|||
* @return 结果 |
|||
*/ |
|||
|
|||
public int deleteCodeRuleDefineByDefineId(Long defineId) |
|||
{ |
|||
return baseMapper.deleteCodeRuleDefineByDefineId(defineId); |
|||
} |
|||
} |
@ -1,112 +0,0 @@ |
|||
package com.lzbi.serial.service; |
|||
|
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import com.lzbi.common.utils.DateUtils; |
|||
import com.lzbi.serial.domain.CodeRuleSerial; |
|||
import com.lzbi.serial.mapper.CodeRuleSerialMapper; |
|||
|
|||
|
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 单据流水号Service业务层处理 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2022-12-20 |
|||
*/ |
|||
@Service |
|||
public class CodeRuleSerialService extends ServiceImpl<CodeRuleSerialMapper, CodeRuleSerial> implements IService<CodeRuleSerial> |
|||
{ |
|||
|
|||
/** |
|||
* 查询单据流水号 |
|||
* |
|||
* @param id 单据流水号主键 |
|||
* @return 单据流水号 |
|||
*/ |
|||
|
|||
public CodeRuleSerial selectCodeRuleSerialById(Long id) |
|||
{ |
|||
return baseMapper.selectCodeRuleSerialById(id); |
|||
} |
|||
|
|||
public CodeRuleSerial selectCodeRuleSerialByHeader(String header){ |
|||
return baseMapper.selectCodeRuleSerialByHeader(header); |
|||
} |
|||
/** |
|||
* 成功获取完成流水号获取为1,失败为0 |
|||
* |
|||
* @param svo 必须包含参数 header 单据头 serialno |
|||
* @return 单据流水号 |
|||
*/ |
|||
|
|||
public int updateCodeRuleSerialLock(CodeRuleSerial svo){ |
|||
return baseMapper.updateCodeRuleSerialLock(svo); |
|||
} |
|||
|
|||
/** |
|||
* 查询单据流水号列表 |
|||
* |
|||
* @param sysBillnoSerial 单据流水号 |
|||
* @return 单据流水号 |
|||
*/ |
|||
|
|||
public List<CodeRuleSerial> selectCodeRuleSerialList(CodeRuleSerial sysBillnoSerial) |
|||
{ |
|||
return baseMapper.selectCodeRuleSerialList(sysBillnoSerial); |
|||
} |
|||
|
|||
/** |
|||
* 新增单据流水号 |
|||
* |
|||
* @param |
|||
* @return 结果 |
|||
*/ |
|||
|
|||
public int insertCodeRuleSerial(CodeRuleSerial codeRuleSerial) |
|||
{ |
|||
codeRuleSerial.setCreatedTime(DateUtils.getNowDate()); |
|||
return baseMapper.insertCodeRuleSerial(codeRuleSerial); |
|||
} |
|||
|
|||
/** |
|||
* 修改单据流水号 |
|||
* |
|||
* @param |
|||
* @return 结果 |
|||
*/ |
|||
|
|||
public int updateCodeRuleSerial(CodeRuleSerial codeRuleSerial) |
|||
{ |
|||
codeRuleSerial.setUpdatedTime(DateUtils.getNowDate()); |
|||
return baseMapper.updateCodeRuleSerial(codeRuleSerial); |
|||
} |
|||
|
|||
/** |
|||
* 批量删除单据流水号 |
|||
* |
|||
* @param ids 需要删除的单据流水号主键 |
|||
* @return 结果 |
|||
*/ |
|||
|
|||
public int deleteCodeRuleSerialByIds(Long[] ids) |
|||
{ |
|||
return baseMapper.deleteCodeRuleSerialByIds(ids); |
|||
} |
|||
|
|||
/** |
|||
* 删除单据流水号信息 |
|||
* |
|||
* @param id 单据流水号主键 |
|||
* @return 结果 |
|||
*/ |
|||
|
|||
public int deleteCodeRuleSerialById(Long id) |
|||
{ |
|||
return baseMapper.deleteCodeRuleSerialById(id); |
|||
} |
|||
} |
@ -0,0 +1,44 @@ |
|||
package com.lzbi.task.domain; |
|||
|
|||
/** |
|||
* 业务操作类型 |
|||
* |
|||
* @author ruoyi |
|||
*/ |
|||
public enum EumValueReadType |
|||
{ |
|||
/** |
|||
* 和值 |
|||
*/ |
|||
SUM("sum"), |
|||
|
|||
/** |
|||
* 均值, |
|||
*/ |
|||
AVG("avg"), |
|||
|
|||
/** |
|||
*除零平均, |
|||
*/ |
|||
AVGNOZERO("avgz"), |
|||
|
|||
/** |
|||
* 开始时间点值 |
|||
*/ |
|||
PVBEGIN("pvbegin"), |
|||
/** |
|||
* 结束时间点值 |
|||
*/ |
|||
PVEND("pvend"), |
|||
; |
|||
private final String type; |
|||
EumValueReadType(String type){ |
|||
this.type=type; |
|||
} |
|||
@Override |
|||
public String toString(){ |
|||
return this.type; |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.lzbi.task.domain; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @auth create by Administrator |
|||
* @date 2023/11/30 |
|||
* ReadQueryParams |
|||
*/ |
|||
@Data |
|||
public class ReadQueryParams { |
|||
private String beginTime; |
|||
private String endTime; |
|||
private List<String> deviceCodes; |
|||
private List<String> paramCodes; |
|||
} |
@ -0,0 +1,39 @@ |
|||
package com.lzbi.task.domain; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @auth create by Administrator |
|||
* @date 2023/11/30 |
|||
* WorkParamInfo |
|||
* 生产数据中设备参数的值 |
|||
*/ |
|||
@Data |
|||
public class WorkParamInfo { |
|||
/**设备编号*/ |
|||
private String deviceCode; |
|||
/**参数编码*/ |
|||
private String paramCode; |
|||
/**统计单元 |
|||
* */ |
|||
private String assetUnitCode; |
|||
/** |
|||
* 统计单元参数编码 |
|||
* */ |
|||
private String assetUnitParamCode; |
|||
/** |
|||
* 读取日期 日期yyyy-MM-dd |
|||
* */ |
|||
private String readDate; |
|||
/**读取时段 |
|||
* */ |
|||
private Integer readPoint; |
|||
/** |
|||
* 值类型 开始时间点值、全平均、结束时间点值、除零平均 |
|||
* */ |
|||
private String valueType; |
|||
/**数值内容 |
|||
* */ |
|||
private Double value; |
|||
|
|||
} |
@ -0,0 +1,143 @@ |
|||
package com.lzbi.task.domain; |
|||
|
|||
import cn.hutool.core.date.DatePattern; |
|||
import cn.hutool.core.date.DateUtil; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
import lombok.NonNull; |
|||
|
|||
import java.util.Date; |
|||
import java.util.Optional; |
|||
|
|||
/** |
|||
* @auth create by Administrator |
|||
* @date 2023/11/30 |
|||
* WorkReadVo |
|||
* 从生产数据库读取的参数统计值 |
|||
*/ |
|||
|
|||
public class WorkReadVo { |
|||
/***/ |
|||
@ApiModelProperty("参数编码") |
|||
private String paramCode; |
|||
@ApiModelProperty("设备编码") |
|||
private String deviceCode; |
|||
@ApiModelProperty("统计时间") |
|||
private Date thour; |
|||
@ApiModelProperty("和值") |
|||
private Double total; |
|||
@ApiModelProperty("总数") |
|||
private Double countsall; |
|||
@ApiModelProperty("除零总数") |
|||
private Double countsz; |
|||
@ApiModelProperty("最大值") |
|||
private Double maxVal; |
|||
@ApiModelProperty("最小值") |
|||
private Double minVal; |
|||
@ApiModelProperty("首值") |
|||
private Double firstVal; |
|||
@ApiModelProperty("末值") |
|||
private Double lastVal; |
|||
@ApiModelProperty("均值") |
|||
private Double avgAll; |
|||
@ApiModelProperty("不计算0值的均值") |
|||
private Double avgNoZero; |
|||
@ApiModelProperty("日期-天") |
|||
private String dateCount; |
|||
@ApiModelProperty("时间-小时") |
|||
private Integer hourCount; |
|||
public String getParamCode() { |
|||
return paramCode; |
|||
} |
|||
|
|||
public void setParamCode(String paramCode) { |
|||
this.paramCode = paramCode; |
|||
} |
|||
|
|||
public String getDeviceCode() { |
|||
return deviceCode; |
|||
} |
|||
|
|||
public void setDeviceCode(String deviceCode) { |
|||
this.deviceCode = deviceCode; |
|||
} |
|||
|
|||
public Date getThour() { |
|||
return thour; |
|||
} |
|||
|
|||
public void setThour(Date thour) { |
|||
this.thour = thour; |
|||
} |
|||
|
|||
public Double getTotal() { |
|||
return total; |
|||
} |
|||
|
|||
public void setTotal(Double total) { |
|||
this.total = Optional.ofNullable(total).orElse(0.00); |
|||
} |
|||
|
|||
public Double getCountsall() { |
|||
return countsall; |
|||
} |
|||
|
|||
public void setCountsall(Double countsall) { |
|||
this.countsall = Optional.ofNullable(countsall).orElse(1.00); |
|||
} |
|||
|
|||
public Double getCountsz() { |
|||
return countsz; |
|||
} |
|||
|
|||
public void setCountsz(Double countsz) { |
|||
this.countsz = Optional.ofNullable(countsz).orElse(1.00); |
|||
} |
|||
|
|||
public Double getMaxVal() { |
|||
return maxVal; |
|||
} |
|||
|
|||
public void setMaxVal(Double maxVal) { |
|||
this.maxVal =Optional.ofNullable(maxVal).orElse(0.00); |
|||
} |
|||
|
|||
public Double getMinVal() { |
|||
return minVal; |
|||
} |
|||
|
|||
public void setMinVal(Double minVal) { |
|||
this.minVal =Optional.ofNullable(minVal).orElse(0.00); |
|||
} |
|||
|
|||
public Double getFirstVal() { |
|||
return firstVal; |
|||
} |
|||
|
|||
public void setFirstVal(Double firstVal) { |
|||
this.firstVal = Optional.ofNullable(firstVal).orElse(0.00); |
|||
} |
|||
|
|||
public Double getLastVal() { |
|||
return lastVal; |
|||
} |
|||
|
|||
public void setLastVal(Double lastVal) { |
|||
this.lastVal = Optional.ofNullable(lastVal).orElse(0.00); |
|||
} |
|||
|
|||
public Double getAvgAll(){ |
|||
return this.total/(this.countsall>0.0?this.countsall:1); |
|||
} |
|||
public Double getAvgNoZero(){ |
|||
return this.total/(this.countsz>0.0?this.countsz:1); |
|||
} |
|||
|
|||
public String getDateCount() { |
|||
return DateUtil.format(this.thour, DatePattern.NORM_DATE_PATTERN); |
|||
} |
|||
|
|||
public Integer getHourCount() { |
|||
return DateUtil.hour(this.thour, true); |
|||
} |
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.lzbi.task.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.lzbi.code.domain.DcBaseCoderuleDefineDao; |
|||
import com.lzbi.code.domain.DcBaseCoderuleSerialDao; |
|||
import com.lzbi.code.domain.DcBusiCoderuleConfigDao; |
|||
import com.lzbi.task.domain.ReadQueryParams; |
|||
import com.lzbi.task.domain.WorkParamInfo; |
|||
import com.lzbi.task.domain.WorkReadVo; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 编码规则定义Mapper接口 |
|||
* |
|||
* @author win |
|||
* @date 2023-11-29 |
|||
*/ |
|||
|
|||
public interface WorkParamReadMapper extends BaseMapper<WorkParamInfo> |
|||
{ |
|||
public List<WorkReadVo> readWorkValue(ReadQueryParams readQueryParams); |
|||
} |
@ -0,0 +1,40 @@ |
|||
package com.lzbi.task.service; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import com.baomidou.dynamic.datasource.annotation.DS; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import com.lzbi.asset.service.DcBusiWorkReadConfigService; |
|||
import com.lzbi.code.domain.DcBaseCoderuleDefineDao; |
|||
import com.lzbi.code.domain.DcBaseCoderuleSerialDao; |
|||
import com.lzbi.code.domain.DcBusiCoderuleConfigDao; |
|||
import com.lzbi.code.domain.codeBodyType; |
|||
import com.lzbi.common.utils.DateUtils; |
|||
import com.lzbi.common.utils.StringUtils; |
|||
import com.lzbi.task.domain.ReadQueryParams; |
|||
import com.lzbi.task.domain.WorkParamInfo; |
|||
import com.lzbi.task.domain.WorkReadVo; |
|||
import com.lzbi.task.mapper.WorkParamReadMapper; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
import java.util.Optional; |
|||
|
|||
/** |
|||
* 编码规则定义Service业务层处理 |
|||
* |
|||
* @author win |
|||
* @date 2023-11-29 |
|||
*/ |
|||
@DS("workDB") |
|||
@Service |
|||
public class WorkParamReadService extends ServiceImpl<WorkParamReadMapper, WorkParamInfo> implements IService<WorkParamInfo> |
|||
|
|||
{ |
|||
/*获取生产单元的参数读取配置 |
|||
* */ |
|||
public List<WorkReadVo> readWorkValue(ReadQueryParams readQueryParams){ |
|||
return baseMapper.readWorkValue(readQueryParams); |
|||
} |
|||
} |
@ -0,0 +1,205 @@ |
|||
<?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.lzbi.code.mapper.DcBaseCoderuleDefineMapper"> |
|||
|
|||
<resultMap type="com.lzbi.code.domain.DcBaseCoderuleDefineDao" id="DcBaseCoderuleDefineResult"> |
|||
<result property="tenantId" column="tenant_id" /> |
|||
<result property="revision" column="revision" /> |
|||
<result property="createdBy" column="created_by" /> |
|||
<result property="createdTime" column="created_time" /> |
|||
<result property="updatedBy" column="updated_by" /> |
|||
<result property="updatedTime" column="updated_time" /> |
|||
<result property="deleteBy" column="delete_by" /> |
|||
<result property="deleteTime" column="delete_time" /> |
|||
<result property="id" column="id" /> |
|||
<result property="codeConfigName" column="code_config_name" /> |
|||
<result property="codeHeader" column="code_header" /> |
|||
<result property="codeBody" column="code_body" /> |
|||
<result property="codeBodyType" column="code_body_type" /> |
|||
<result property="codeSerialLength" column="code_serial_length" /> |
|||
<result property="codeSplitFlag" column="code_split_flag" /> |
|||
</resultMap> |
|||
<resultMap type="com.lzbi.code.domain.DcBaseCoderuleSerialDao" id="rmDcBaseCoderuleSerial"> |
|||
<!-- 租户号 --> |
|||
<result property="tenantId" column="tenant_id"/> |
|||
<!-- 乐观锁 --> |
|||
<result property="revision" column="revision"/> |
|||
<!-- 创建人 --> |
|||
<result property="createdBy" column="created_by"/> |
|||
<!-- 创建时间 --> |
|||
<result property="createdTime" column="created_time"/> |
|||
<!-- 更新人 --> |
|||
<result property="updatedBy" column="updated_by"/> |
|||
<!-- 更新时间 --> |
|||
<result property="updatedTime" column="updated_time"/> |
|||
<!-- 删除人 --> |
|||
<result property="deleteBy" column="delete_by"/> |
|||
<!-- 删除时间 --> |
|||
<result property="deleteTime" column="delete_time"/> |
|||
<!-- 主键 --> |
|||
<result property="id" column="id"/> |
|||
<!-- 规则定义的ID --> |
|||
<result property="codeRuleId" column="code_rule_id"/> |
|||
<!-- 流水号 --> |
|||
<result property="serialId" column="serial_id"/> |
|||
</resultMap> |
|||
<resultMap type="com.lzbi.code.domain.DcBusiCoderuleConfigDao" id="rmDcBusiCoderuleConfig"> |
|||
<!-- 租户号 --> |
|||
<result property="tenantId" column="tenant_id"/> |
|||
<!-- 乐观锁 --> |
|||
<result property="revision" column="revision"/> |
|||
<!-- 创建人 --> |
|||
<result property="createdBy" column="created_by"/> |
|||
<!-- 创建时间 --> |
|||
<result property="createdTime" column="created_time"/> |
|||
<!-- 更新人 --> |
|||
<result property="updatedBy" column="updated_by"/> |
|||
<!-- 更新时间 --> |
|||
<result property="updatedTime" column="updated_time"/> |
|||
<!-- 删除人 --> |
|||
<result property="deleteBy" column="delete_by"/> |
|||
<!-- 删除时间 --> |
|||
<result property="deleteTime" column="delete_time"/> |
|||
<!-- 主键 --> |
|||
<result property="id" column="id"/> |
|||
<!-- 规则名称 --> |
|||
<result property="configName" column="config_name"/> |
|||
<!-- 业务代码 --> |
|||
<result property="nodeCode" column="node_code"/> |
|||
<!-- 字段名称 --> |
|||
<result property="columnName" column="column_name"/> |
|||
<!-- 规则ID --> |
|||
<result property="ruleId" column="rule_id"/> |
|||
</resultMap> |
|||
<sql id="selectDcBaseCoderuleDefineVo"> |
|||
select tenant_id, revision, created_by, created_time, updated_by, updated_time, delete_by, delete_time, id, code_config_name, code_header, code_body, code_body_type, code_serial_length, code_split_flag from dc_base_coderule_define |
|||
</sql> |
|||
|
|||
<select id="selectDcBaseCoderuleDefineDaoList" parameterType="DcBaseCoderuleDefineDao" resultMap="DcBaseCoderuleDefineResult"> |
|||
<include refid="selectDcBaseCoderuleDefineVo"/> |
|||
<where> |
|||
<if test="codeConfigName != null and codeConfigName != ''"> and code_config_name like concat('%', #{codeConfigName}, '%')</if> |
|||
<if test="codeHeader != null and codeHeader != ''"> and code_header = #{codeHeader}</if> |
|||
<if test="codeBody != null and codeBody != ''"> and code_body = #{codeBody}</if> |
|||
<if test="codeBodyType != null and codeBodyType != ''"> and code_body_type = #{codeBodyType}</if> |
|||
<if test="codeSerialLength != null "> and code_serial_length = #{codeSerialLength}</if> |
|||
<if test="codeSplitFlag != null and codeSplitFlag != ''"> and code_split_flag = #{codeSplitFlag}</if> |
|||
</where> |
|||
</select> |
|||
|
|||
<select id="selectDcBaseCoderuleDefineDaoById" parameterType="Long" resultMap="DcBaseCoderuleDefineResult"> |
|||
<include refid="selectDcBaseCoderuleDefineVo"/> |
|||
where id = #{id} |
|||
</select> |
|||
|
|||
<insert id="insertDcBaseCoderuleDefineDao" parameterType="DcBaseCoderuleDefineDao" useGeneratedKeys="true" keyProperty="id"> |
|||
insert into dc_base_coderule_define |
|||
<trim prefix="(" suffix=")" suffixOverrides=","> |
|||
<if test="tenantId != null">tenant_id,</if> |
|||
<if test="revision != null">revision,</if> |
|||
<if test="createdBy != null">created_by,</if> |
|||
<if test="createdTime != null">created_time,</if> |
|||
<if test="updatedBy != null">updated_by,</if> |
|||
<if test="updatedTime != null">updated_time,</if> |
|||
<if test="deleteBy != null">delete_by,</if> |
|||
<if test="deleteTime != null">delete_time,</if> |
|||
<if test="codeConfigName != null">code_config_name,</if> |
|||
<if test="codeHeader != null">code_header,</if> |
|||
<if test="codeBody != null">code_body,</if> |
|||
<if test="codeBodyType != null">code_body_type,</if> |
|||
<if test="codeSerialLength != null">code_serial_length,</if> |
|||
<if test="codeSplitFlag != null">code_split_flag,</if> |
|||
</trim> |
|||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
|||
<if test="tenantId != null">#{tenantId},</if> |
|||
<if test="revision != null">#{revision},</if> |
|||
<if test="createdBy != null">#{createdBy},</if> |
|||
<if test="createdTime != null">#{createdTime},</if> |
|||
<if test="updatedBy != null">#{updatedBy},</if> |
|||
<if test="updatedTime != null">#{updatedTime},</if> |
|||
<if test="deleteBy != null">#{deleteBy},</if> |
|||
<if test="deleteTime != null">#{deleteTime},</if> |
|||
<if test="codeConfigName != null">#{codeConfigName},</if> |
|||
<if test="codeHeader != null">#{codeHeader},</if> |
|||
<if test="codeBody != null">#{codeBody},</if> |
|||
<if test="codeBodyType != null">#{codeBodyType},</if> |
|||
<if test="codeSerialLength != null">#{codeSerialLength},</if> |
|||
<if test="codeSplitFlag != null">#{codeSplitFlag},</if> |
|||
</trim> |
|||
</insert> |
|||
|
|||
<update id="updateDcBaseCoderuleDefineDao" parameterType="DcBaseCoderuleDefineDao"> |
|||
update dc_base_coderule_define |
|||
<trim prefix="SET" suffixOverrides=","> |
|||
<if test="tenantId != null">tenant_id = #{tenantId},</if> |
|||
<if test="revision != null">revision = #{revision},</if> |
|||
<if test="createdBy != null">created_by = #{createdBy},</if> |
|||
<if test="createdTime != null">created_time = #{createdTime},</if> |
|||
<if test="updatedBy != null">updated_by = #{updatedBy},</if> |
|||
<if test="updatedTime != null">updated_time = #{updatedTime},</if> |
|||
<if test="deleteBy != null">delete_by = #{deleteBy},</if> |
|||
<if test="deleteTime != null">delete_time = #{deleteTime},</if> |
|||
<if test="codeConfigName != null">code_config_name = #{codeConfigName},</if> |
|||
<if test="codeHeader != null">code_header = #{codeHeader},</if> |
|||
<if test="codeBody != null">code_body = #{codeBody},</if> |
|||
<if test="codeBodyType != null">code_body_type = #{codeBodyType},</if> |
|||
<if test="codeSerialLength != null">code_serial_length = #{codeSerialLength},</if> |
|||
<if test="codeSplitFlag != null">code_split_flag = #{codeSplitFlag},</if> |
|||
</trim> |
|||
where id = #{id} |
|||
</update> |
|||
|
|||
<delete id="deleteDcBaseCoderuleDefineDaoById" parameterType="Long"> |
|||
delete from dc_base_coderule_define where id = #{id} |
|||
</delete> |
|||
|
|||
<delete id="deleteDcBaseCoderuleDefineDaoByIds" parameterType="String"> |
|||
delete from dc_base_coderule_define where id in |
|||
<foreach item="id" collection="array" open="(" separator="," close=")"> |
|||
#{id} |
|||
</foreach> |
|||
</delete> |
|||
|
|||
<select id="getSerialByRuleId" resultMap="rmDcBaseCoderuleSerial" parameterType="long"> |
|||
select |
|||
tenant_id, |
|||
revision, |
|||
created_by, |
|||
created_time, |
|||
updated_by, |
|||
updated_time, |
|||
delete_by, |
|||
delete_time, |
|||
id, |
|||
code_rule_id, |
|||
serial_id |
|||
from dc_base_coderule_serial |
|||
where code_rule_id=#{param1} |
|||
</select> |
|||
|
|||
<update id="updateSerial" parameterType="long"> |
|||
update dc_base_coderule_serial |
|||
set revision=#{param2} , serial_id=#{param2} |
|||
where revision=#{param1} and id=#{param3} |
|||
</update> |
|||
|
|||
<select id="getRuleIdByBusicode" resultMap="rmDcBusiCoderuleConfig" parameterType="String"> |
|||
select tenant_id, |
|||
revision, |
|||
created_by, |
|||
created_time, |
|||
updated_by, |
|||
updated_time, |
|||
delete_by, |
|||
delete_time, |
|||
id, |
|||
config_name, |
|||
node_code, |
|||
column_name, |
|||
rule_id |
|||
from dc_busi_coderule_config |
|||
where node_code=#{busiCode} |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,123 @@ |
|||
<?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.lzbi.asset.mapper.DcBusiWorkReadConfigMapper"> |
|||
<resultMap type="com.lzbi.asset.domain.DcBusiWorkReadConfig" id="rmDcBusiWorkReadConfig"> |
|||
<!-- 租户号 --> |
|||
<result property="tenantId" column="tenant_id"/> |
|||
<!-- 乐观锁 --> |
|||
<result property="revision" column="revision"/> |
|||
<!-- 创建人 --> |
|||
<result property="createdBy" column="created_by"/> |
|||
<!-- 创建时间 --> |
|||
<result property="createdTime" column="created_time"/> |
|||
<!-- 更新人 --> |
|||
<result property="updatedBy" column="updated_by"/> |
|||
<!-- 更新时间 --> |
|||
<result property="updatedTime" column="updated_time"/> |
|||
<!-- 删除人 --> |
|||
<result property="deleteBy" column="delete_by"/> |
|||
<!-- 删除时间 --> |
|||
<result property="deleteTime" column="delete_time"/> |
|||
<!-- 主键 --> |
|||
<result property="id" column="id"/> |
|||
<!-- 统计单元编码 --> |
|||
<result property="assetCode" column="asset_code"/> |
|||
<!-- 统计单元参数编码 --> |
|||
<result property="assetParamCode" column="asset_param_code"/> |
|||
<!-- 目标参数编码 --> |
|||
<result property="goalParamCode" column="goal_param_code"/> |
|||
<!-- 目标参数辅助查询参数1 --> |
|||
<result property="goalParamExt1" column="goal_param_ext1"/> |
|||
<!-- 目标参数辅助查询参数2 --> |
|||
<result property="goalParamExt2" column="goal_param_ext2"/> |
|||
<!-- 读取数值类型 --> |
|||
<result property="goalParamType" column="goal_param_type"/> |
|||
<!-- 数据来源 --> |
|||
<result property="goalSource" column="goal_source"/> |
|||
</resultMap> |
|||
<sql id="baseQuerySql"> |
|||
select |
|||
tenant_id, |
|||
revision, |
|||
created_by, |
|||
created_time, |
|||
updated_by, |
|||
updated_time, |
|||
delete_by, |
|||
delete_time, |
|||
id, |
|||
asset_code, |
|||
asset_param_code, |
|||
goal_param_code, |
|||
goal_param_ext1, |
|||
goal_param_ext2, |
|||
goal_param_type, |
|||
goal_source, |
|||
from dc_busi_work_read_config |
|||
</sql> |
|||
<select id="selectByVo" resultMap="rmDcBusiWorkReadConfig" parameterType="com.lzbi.asset.domain.DcBusiWorkReadConfig"> |
|||
<include refid="baseQuerySql"/> |
|||
<where> |
|||
<if test="tenantId != null "> and tenant_id = #{tenantId}</if> |
|||
<if test="revision != null "> and revision = #{revision}</if> |
|||
<if test="createdBy != null and createdBy != ''"> and created_by = #{createdBy}</if> |
|||
<if test="createdTime != null "> and created_time = #{createdTime}</if> |
|||
<if test="updatedBy != null and updatedBy != ''"> and updated_by = #{updatedBy}</if> |
|||
<if test="updatedTime != null a"> and updated_time = #{updatedTime}</if> |
|||
<if test="deleteBy != null and deleteBy != ''"> and delete_by = #{deleteBy}</if> |
|||
<if test="deleteTime != null "> and delete_time = #{deleteTime}</if> |
|||
<if test="id != null "> and id = #{id}</if> |
|||
<if test="assetCode != null and assetCode != ''"> and asset_code = #{assetCode}</if> |
|||
<if test="assetParamCode != null and assetParamCode != ''"> and asset_param_code = #{assetParamCode}</if> |
|||
<if test="goalParamCode != null and goalParamCode != ''"> and goal_param_code = #{goalParamCode}</if> |
|||
<if test="goalParamExt1 != null and goalParamExt1 != ''"> and goal_param_ext1 = #{goalParamExt1}</if> |
|||
<if test="goalParamExt2 != null and goalParamExt2 != ''"> and goal_param_ext2 = #{goalParamExt2}</if> |
|||
<if test="goalParamType != null and goalParamType != ''"> and goal_param_type = #{goalParamType}</if> |
|||
<if test="goalSource != null and goalSource != ''"> and goal_source = #{goalSource}</if> |
|||
|
|||
</where> |
|||
</select> |
|||
<insert id="insertByVo" parameterType="com.lzbi.asset.domain.DcBusiWorkReadConfig"> |
|||
insert into dc_busi_work_read_config |
|||
<trim prefix="(" suffix=")" suffixOverrides=","> |
|||
<if test="tenantId != null and tenantId != ''">tenant_id,</if> |
|||
<if test="revision != null and revision != ''">revision,</if> |
|||
<if test="createdBy != null and createdBy != ''">created_by,</if> |
|||
<if test="createdTime != null and createdTime != ''">created_time,</if> |
|||
<if test="updatedBy != null and updatedBy != ''">updated_by,</if> |
|||
<if test="updatedTime != null and updatedTime != ''">updated_time,</if> |
|||
<if test="deleteBy != null and deleteBy != ''">delete_by,</if> |
|||
<if test="deleteTime != null and deleteTime != ''">delete_time,</if> |
|||
<if test="id != null and id != ''">id,</if> |
|||
<if test="assetCode != null and assetCode != ''">asset_code,</if> |
|||
<if test="assetParamCode != null and assetParamCode != ''">asset_param_code,</if> |
|||
<if test="goalParamCode != null and goalParamCode != ''">goal_param_code,</if> |
|||
<if test="goalParamExt1 != null and goalParamExt1 != ''">goal_param_ext1,</if> |
|||
<if test="goalParamExt2 != null and goalParamExt2 != ''">goal_param_ext2,</if> |
|||
<if test="goalParamType != null and goalParamType != ''">goal_param_type,</if> |
|||
<if test="goalSource != null and goalSource != ''">goal_source,</if> |
|||
</trim> |
|||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
|||
<if test="tenantId != null and tenantId != ''">#{tenantId},</if> |
|||
<if test="revision != null and revision != ''">#{revision},</if> |
|||
<if test="createdBy != null and createdBy != ''">#{createdBy},</if> |
|||
<if test="createdTime != null and createdTime != ''">#{createdTime},</if> |
|||
<if test="updatedBy != null and updatedBy != ''">#{updatedBy},</if> |
|||
<if test="updatedTime != null and updatedTime != ''">#{updatedTime},</if> |
|||
<if test="deleteBy != null and deleteBy != ''">#{deleteBy},</if> |
|||
<if test="deleteTime != null and deleteTime != ''">#{deleteTime},</if> |
|||
<if test="id != null and id != ''">#{id},</if> |
|||
<if test="assetCode != null and assetCode != ''">#{assetCode},</if> |
|||
<if test="assetParamCode != null and assetParamCode != ''">#{assetParamCode},</if> |
|||
<if test="goalParamCode != null and goalParamCode != ''">#{goalParamCode},</if> |
|||
<if test="goalParamExt1 != null and goalParamExt1 != ''">#{goalParamExt1},</if> |
|||
<if test="goalParamExt2 != null and goalParamExt2 != ''">#{goalParamExt2},</if> |
|||
<if test="goalParamType != null and goalParamType != ''">#{goalParamType},</if> |
|||
<if test="goalSource != null and goalSource != ''">#{goalSource},</if> |
|||
|
|||
</trim> |
|||
</insert> |
|||
</mapper> |
@ -0,0 +1,42 @@ |
|||
<?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.lzbi.task.mapper.WorkParamReadMapper"> |
|||
<resultMap type="com.lzbi.task.domain.WorkReadVo" id="WorkReadVoResult"> |
|||
<result property="deviceCode" column="device_uuid" /> |
|||
<result property="paramCode" column="param_code" /> |
|||
<result property="thour" column="thour" /> |
|||
<result property="total" column="total" /> |
|||
<result property="countsall" column="countsall" /> |
|||
<result property="countsz" column="countsz" /> |
|||
<result property="maxVal" column="maxVal" /> |
|||
<result property="minVal" column="minVal" /> |
|||
<result property="firstVal" column="firstVal" /> |
|||
<result property="lastVal" column="lastVal" /> |
|||
</resultMap> |
|||
|
|||
<select id="readWorkValue" resultMap="WorkReadVoResult" parameterType="com.lzbi.task.domain.ReadQueryParams"> |
|||
SELECT param_code,device_uuid, |
|||
time_bucket('1 HOUR', timestamp_key) AS thour, |
|||
sum(case when param_value_num>0.00 then param_value_num else 0 end ) AS total, |
|||
count(*) AS countsall, |
|||
sum(case when param_value_num>0.00 then 1 else 0 end) AS countsz, |
|||
max(param_value_num) AS maxVal, |
|||
first(param_value_num, timestamp_key) AS firstVal, |
|||
last(param_value_num,timestamp_key) AS lastVal, |
|||
min(param_value_num) AS minVal |
|||
FROM dc_base_log_history_level1 AS his |
|||
where timestamp_key BETWEEN to_timestamp(#{beginTime},'yyyy-MM-dd hh24:mi:ss') and to_timestamp(#{endTime},'yyyy-MM-dd hh24:mi:ss') |
|||
and device_uuid in |
|||
<foreach item="item" index="index" collection="deviceCodes" separator=","> |
|||
( #{item}) |
|||
</foreach> |
|||
and param_code in |
|||
<foreach item="item" index="index" collection="paramCodes" separator=","> |
|||
( #{item}) |
|||
</foreach> |
|||
GROUP BY thour, param_code,device_uuid |
|||
ORDER BY thour asc |
|||
</select> |
|||
</mapper> |
@ -1,93 +0,0 @@ |
|||
<?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.lzbi.serial.mapper.CodeRuleDefineMapper"> |
|||
|
|||
<resultMap type="CodeRuleDefine" id="codeRuleDefineResult"> |
|||
<result property="defineId" column="define_id" /> |
|||
<result property="defHeader" column="def_header" /> |
|||
<result property="defClass" column="def_class" /> |
|||
<result property="deptId" column="dept_id" /> |
|||
<result property="createdBy" column="create_by" /> |
|||
<result property="createdTime" column="create_time" /> |
|||
<result property="updatedBy" column="update_by" /> |
|||
<result property="updatedTime" column="update_time" /> |
|||
<result property="defHeaderType" column="def_header_type" /> |
|||
<result property="serialLength" column="serial_length" /> |
|||
|
|||
</resultMap> |
|||
|
|||
<sql id="selectCodeRuleDefineVo"> |
|||
select define_id, def_header, def_class, dept_id, create_by, create_time, update_by, update_time,def_header_type,serial_length from sys_billno_define |
|||
</sql> |
|||
|
|||
<select id="selectCodeRuleDefineList" parameterType="CodeRuleDefine" resultMap="codeRuleDefineResult"> |
|||
<include refid="selectCodeRuleDefineVo"/> |
|||
<where> |
|||
<if test="defHeader != null and defHeader != ''"> and def_header = #{defHeader}</if> |
|||
<if test="defClass != null and defClass != ''"> and def_class = #{defClass}</if> |
|||
<if test="deptId != null "> and dept_id = #{deptId}</if> |
|||
</where> |
|||
</select> |
|||
|
|||
<select id="selectCodeRuleDefineByDefineId" parameterType="Long" resultMap="codeRuleDefineResult"> |
|||
<include refid="selectCodeRuleDefineVo"/> |
|||
where define_id = #{defineId} |
|||
</select> |
|||
|
|||
<insert id="insertCodeRuleDefine" parameterType="CodeRuleDefine"> |
|||
insert into sys_billno_define |
|||
<trim prefix="(" suffix=")" suffixOverrides=","> |
|||
<if test="defineId != null">define_id,</if> |
|||
<if test="defHeader != null">def_header,</if> |
|||
<if test="defClass != null">def_class,</if> |
|||
<if test="deptId != null">dept_id,</if> |
|||
<if test="createBy != null">create_by,</if> |
|||
<if test="createTime != null">create_time,</if> |
|||
<if test="updateBy != null">update_by,</if> |
|||
<if test="updateTime != null">update_time,</if> |
|||
<if test="defHeaderType != null">def_header_type,</if> |
|||
<if test="serialLength != null">serial_length,</if> |
|||
</trim> |
|||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
|||
<if test="defineId != null">#{defineId},</if> |
|||
<if test="defHeader != null">#{defHeader},</if> |
|||
<if test="defClass != null">#{defClass},</if> |
|||
<if test="deptId != null">#{deptId},</if> |
|||
<if test="createBy != null">#{createBy},</if> |
|||
<if test="createTime != null">#{createTime},</if> |
|||
<if test="updateBy != null">#{updateBy},</if> |
|||
<if test="updateTime != null">#{updateTime},</if> |
|||
<if test="defHeaderType != null">#{defHeaderType},</if> |
|||
<if test="serialLength != null">#{serialLength},</if> |
|||
</trim> |
|||
</insert> |
|||
|
|||
<update id="updateCodeRuleDefine" parameterType="CodeRuleDefine"> |
|||
update sys_billno_define |
|||
<trim prefix="SET" suffixOverrides=","> |
|||
<if test="defHeader != null">def_header = #{defHeader},</if> |
|||
<if test="defClass != null">def_class = #{defClass},</if> |
|||
<if test="deptId != null">dept_id = #{deptId},</if> |
|||
<if test="createBy != null">create_by = #{createBy},</if> |
|||
<if test="createTime != null">create_time = #{createTime},</if> |
|||
<if test="updateBy != null">update_by = #{updateBy},</if> |
|||
<if test="updateTime != null">update_time = #{updateTime},</if> |
|||
<if test="defHeaderType != null">def_header_type = #{defHeaderType},</if> |
|||
<if test="serialLength != null">serial_length = #{serialLength},</if> |
|||
</trim> |
|||
where define_id = #{defineId} |
|||
</update> |
|||
|
|||
<delete id="deleteCodeRuleDefineByDefineId" parameterType="Long"> |
|||
delete from sys_billno_define where define_id = #{defineId} |
|||
</delete> |
|||
|
|||
<delete id="deleteCodeRuleDefineByDefineIds" parameterType="String"> |
|||
delete from sys_billno_define where define_id in |
|||
<foreach item="defineId" collection="array" open="(" separator="," close=")"> |
|||
#{defineId} |
|||
</foreach> |
|||
</delete> |
|||
</mapper> |
@ -1,99 +0,0 @@ |
|||
<?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.lzbi.serial.mapper.CodeRuleSerialMapper"> |
|||
|
|||
<resultMap type="CodeRuleSerial" id="CodeRuleSerialResult"> |
|||
<result property="id" column="id" /> |
|||
<result property="headerBillno" column="header_billno" /> |
|||
<result property="lockSerial" column="lock_serial" /> |
|||
<result property="serialNo" column="serial_no" /> |
|||
<result property="createdBy" column="create_by" /> |
|||
<result property="createdTime" column="create_time" /> |
|||
<result property="updatedBy" column="update_by" /> |
|||
<result property="updatedTime" column="update_time" /> |
|||
</resultMap> |
|||
|
|||
<sql id="selectCodeRuleSerialVo"> |
|||
select id, header_billno, lock_serial, seselectCodeRuleSerialListrial_no, create_by, create_time, update_by, update_time from sys_billno_serial |
|||
</sql> |
|||
|
|||
<select id="" parameterType="CodeRuleSerial" resultMap="CodeRuleSerialResult"> |
|||
<include refid="selectCodeRuleSerialVo"/> |
|||
<where> |
|||
<if test="headerBillno != null and headerBillno != ''"> and header_billno = #{headerBillno}</if> |
|||
<if test="lockSerial != null "> and lock_serial = #{lockSerial}</if> |
|||
<if test="serialNo != null "> and serial_no = #{serialNo}</if> |
|||
</where> |
|||
</select> |
|||
|
|||
<select id="selectCodeRuleSerialById" parameterType="Long" resultMap="CodeRuleSerialResult"> |
|||
<include refid="selectCodeRuleSerialVo"/> |
|||
where id = #{id} |
|||
</select> |
|||
|
|||
<insert id="insertCodeRuleSerial" parameterType="CodeRuleSerial" useGeneratedKeys="true" keyProperty="id"> |
|||
insert into sys_billno_serial |
|||
<trim prefix="(" suffix=")" suffixOverrides=","> |
|||
<if test="headerBillno != null">header_billno,</if> |
|||
<if test="lockSerial != null">lock_serial,</if> |
|||
<if test="serialNo != null">serial_no,</if> |
|||
<if test="createBy != null">create_by,</if> |
|||
<if test="createTime != null">create_time,</if> |
|||
<if test="updateBy != null">update_by,</if> |
|||
<if test="updateTime != null">update_time,</if> |
|||
</trim> |
|||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
|||
<if test="headerBillno != null">#{headerBillno},</if> |
|||
<if test="lockSerial != null">#{lockSerial},</if> |
|||
<if test="serialNo != null">#{serialNo},</if> |
|||
<if test="createBy != null">#{createBy},</if> |
|||
<if test="createTime != null">#{createTime},</if> |
|||
<if test="updateBy != null">#{updateBy},</if> |
|||
<if test="updateTime != null">#{updateTime},</if> |
|||
</trim> |
|||
</insert> |
|||
|
|||
<update id="updateCodeRuleSerial" parameterType="CodeRuleSerial"> |
|||
update sys_billno_serial |
|||
<trim prefix="SET" suffixOverrides=","> |
|||
<if test="headerBillno != null">header_billno = #{headerBillno},</if> |
|||
<if test="lockSerial != null">lock_serial = #{lockSerial},</if> |
|||
<if test="serialNo != null">serial_no = #{serialNo},</if> |
|||
<if test="createBy != null">create_by = #{createBy},</if> |
|||
<if test="createTime != null">create_time = #{createTime},</if> |
|||
<if test="updateBy != null">update_by = #{updateBy},</if> |
|||
<if test="updateTime != null">update_time = #{updateTime},</if> |
|||
</trim> |
|||
where id = #{id} |
|||
</update> |
|||
|
|||
<delete id="deleteCodeRuleSerialById" parameterType="Long"> |
|||
delete from sys_billno_serial where id = #{id} |
|||
</delete> |
|||
|
|||
<delete id="deleteCodeRuleSerialByIds" parameterType="String"> |
|||
delete from sys_billno_serial where id in |
|||
<foreach item="id" collection="array" open="(" separator="," close=")"> |
|||
#{id} |
|||
</foreach> |
|||
</delete> |
|||
|
|||
<!-- add by zhousq --> |
|||
<update id="updateCodeRuleSerialLock" parameterType="CodeRuleSerial"> |
|||
update sys_billno_serial |
|||
<trim prefix="SET" suffixOverrides=","> |
|||
lock_serial= #{serialNo},serial_no = #{serialNo}, |
|||
<if test="updateBy != null">update_by = #{updateBy},</if> |
|||
<if test="updateTime != null">update_time = #{updateTime},</if> |
|||
</trim> |
|||
where header_billno = #{headerBillno} and lock_serial= #{lockSerial} |
|||
</update> |
|||
|
|||
<select id="selectCodeRuleSerialByHeader" parameterType="String" resultMap="CodeRuleSerialResult"> |
|||
<include refid="selectCodeRuleSerialVo"/> |
|||
where header_billno = #{headerBillno} |
|||
</select> |
|||
|
|||
</mapper> |
Loading…
Reference in new issue