update add产线信息

master
yinq 3 months ago
parent f14dcd15fe
commit c0003881bb

@ -0,0 +1,116 @@
package org.dromara.mes.controller;
import java.util.List;
import lombok.RequiredArgsConstructor;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.*;
import cn.dev33.satoken.annotation.SaCheckPermission;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.web.core.BaseController;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.excel.utils.ExcelUtil;
import org.dromara.mes.domain.vo.ProdBaseProdLineInfoVo;
import org.dromara.mes.domain.bo.ProdBaseProdLineInfoBo;
import org.dromara.mes.service.IProdBaseProdLineInfoService;
import org.dromara.common.mybatis.core.page.TableDataInfo;
/**
* 线
* 访:/mes/baseProdLineInfo
*
* @author Yinq
* @date 2025-01-06
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/baseProdLineInfo")
public class ProdBaseProdLineInfoController extends BaseController {
private final IProdBaseProdLineInfoService prodBaseProdLineInfoService;
/**
* 线
*/
@SaCheckPermission("mes:baseProdLineInfo:list")
@GetMapping("/list")
public TableDataInfo<ProdBaseProdLineInfoVo> list(ProdBaseProdLineInfoBo bo, PageQuery pageQuery) {
return prodBaseProdLineInfoService.queryPageList(bo, pageQuery);
}
/**
* 线
*/
@GetMapping("/getProdLineList")
public R<List<ProdBaseProdLineInfoVo>> getFactoryList(ProdBaseProdLineInfoBo bo) {
List<ProdBaseProdLineInfoVo> list = prodBaseProdLineInfoService.queryList(bo);
return R.ok(list);
}
/**
* 线
*/
@SaCheckPermission("mes:baseProdLineInfo:export")
@Log(title = "产线信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(ProdBaseProdLineInfoBo bo, HttpServletResponse response) {
List<ProdBaseProdLineInfoVo> list = prodBaseProdLineInfoService.queryList(bo);
ExcelUtil.exportExcel(list, "产线信息", ProdBaseProdLineInfoVo.class, response);
}
/**
* 线
*
* @param prodLineId
*/
@SaCheckPermission("mes:baseProdLineInfo:query")
@GetMapping("/{prodLineId}")
public R<ProdBaseProdLineInfoVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long prodLineId) {
return R.ok(prodBaseProdLineInfoService.queryById(prodLineId));
}
/**
* 线
*/
@SaCheckPermission("mes:baseProdLineInfo:add")
@Log(title = "产线信息", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody ProdBaseProdLineInfoBo bo) {
return toAjax(prodBaseProdLineInfoService.insertByBo(bo));
}
/**
* 线
*/
@SaCheckPermission("mes:baseProdLineInfo:edit")
@Log(title = "产线信息", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ProdBaseProdLineInfoBo bo) {
return toAjax(prodBaseProdLineInfoService.updateByBo(bo));
}
/**
* 线
*
* @param prodLineIds
*/
@SaCheckPermission("mes:baseProdLineInfo:remove")
@Log(title = "产线信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{prodLineIds}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] prodLineIds) {
return toAjax(prodBaseProdLineInfoService.deleteWithValidByIds(List.of(prodLineIds), true));
}
}

@ -50,8 +50,9 @@ public class ProdBaseWorkshopInfoController extends BaseController {
*
*/
@GetMapping("/getWorkshopList")
public List<ProdBaseWorkshopInfoVo> getFactoryList(ProdBaseWorkshopInfoBo bo) {
return prodBaseWorkshopInfoService.queryList(bo);
public R<List<ProdBaseWorkshopInfoVo>> getFactoryList(ProdBaseWorkshopInfoBo bo) {
List<ProdBaseWorkshopInfoVo> list = prodBaseWorkshopInfoService.queryList(bo);
return R.ok(list);
}
/**

@ -0,0 +1,63 @@
package org.dromara.mes.domain;
import org.dromara.common.tenant.core.TenantEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 线 prod_base_prod_line_info
*
* @author Yinq
* @date 2025-01-06
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("prod_base_prod_line_info")
public class ProdBaseProdLineInfo extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 线ID
*/
@TableId(value = "prod_line_id", type = IdType.AUTO)
private Long prodLineId;
/**
* 线
*/
private String prodLineCode;
/**
* 线
*/
private String prodLineName;
/**
* 线
*/
private String prodLineType;
/**
*
*/
private Long workshopId;
/**
* 1 0
*/
private String activeFlag;
/**
*
*/
private String remark;
@TableField(exist = false)
private String workshopName;//字段映射
}

@ -0,0 +1,63 @@
package org.dromara.mes.domain.bo;
import org.dromara.mes.domain.ProdBaseProdLineInfo;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
/**
* 线 prod_base_prod_line_info
*
* @author Yinq
* @date 2025-01-06
*/
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = ProdBaseProdLineInfo.class, reverseConvertGenerate = false)
public class ProdBaseProdLineInfoBo extends BaseEntity {
/**
* 线ID
*/
private Long prodLineId;
/**
* 线
*/
@NotBlank(message = "产线编号不能为空", groups = {AddGroup.class, EditGroup.class})
private String prodLineCode;
/**
* 线
*/
@NotBlank(message = "产线名称不能为空", groups = {AddGroup.class, EditGroup.class})
private String prodLineName;
/**
* 线
*/
@NotBlank(message = "产线类型不能为空", groups = {AddGroup.class, EditGroup.class})
private String prodLineType;
/**
*
*/
@NotNull(message = "所属车间不能为空", groups = {AddGroup.class, EditGroup.class})
private Long workshopId;
/**
* 1 0
*/
private String activeFlag;
/**
*
*/
private String remark;
}

@ -0,0 +1,118 @@
package org.dromara.mes.domain.vo;
import org.dromara.mes.domain.ProdBaseProdLineInfo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
/**
* 线 prod_base_prod_line_info
*
* @author Yinq
* @date 2025-01-06
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = ProdBaseProdLineInfo.class)
public class ProdBaseProdLineInfoVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 线ID
*/
@ExcelProperty(value = "产线ID")
private Long prodLineId;
/**
*
*/
@ExcelProperty(value = "租户编号")
private String tenantId;
/**
* 线
*/
@ExcelProperty(value = "产线编号")
private String prodLineCode;
/**
* 线
*/
@ExcelProperty(value = "产线名称")
private String prodLineName;
/**
* 线
*/
@ExcelProperty(value = "产线类型", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "prod_line_type")
private String prodLineType;
/**
*
*/
@ExcelProperty(value = "所属车间")
private Long workshopId;
/**
*
*/
@ExcelProperty(value = "所属车间名称")
private String workshopName;
/**
* 1 0
*/
@ExcelProperty(value = "激活标识", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "active_flag")
private String activeFlag;
/**
*
*/
@ExcelProperty(value = "备注")
private String remark;
/**
*
*/
@ExcelProperty(value = "创建部门")
private Long createDept;
/**
*
*/
@ExcelProperty(value = "创建人")
private Long createBy;
/**
*
*/
@ExcelProperty(value = "创建时间")
private Date createTime;
/**
*
*/
@ExcelProperty(value = "更新人")
private Long updateBy;
/**
*
*/
@ExcelProperty(value = "更新时间")
private Date updateTime;
}

@ -58,6 +58,12 @@ public class ProdBaseWorkshopInfoVo implements Serializable {
@ExcelProperty(value = "所属工厂ID")
private Long factoryId;
/**
*
*/
@ExcelProperty(value = "所属工厂名称")
private String factoryName;
/**
* (1 0)
*/
@ -100,10 +106,4 @@ public class ProdBaseWorkshopInfoVo implements Serializable {
@ExcelProperty(value = "更新时间")
private Date updateTime;
/**
*
*/
@ExcelProperty(value = "所属工厂名称")
private String factoryName;
}

@ -0,0 +1,15 @@
package org.dromara.mes.mapper;
import org.dromara.mes.domain.ProdBaseProdLineInfo;
import org.dromara.mes.domain.vo.ProdBaseProdLineInfoVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
/**
* 线Mapper
*
* @author Yinq
* @date 2025-01-06
*/
public interface ProdBaseProdLineInfoMapper extends BaseMapperPlus<ProdBaseProdLineInfo, ProdBaseProdLineInfoVo> {
}

@ -0,0 +1,69 @@
package org.dromara.mes.service;
import org.dromara.mes.domain.ProdBaseProdLineInfo;
import org.dromara.mes.domain.vo.ProdBaseProdLineInfoVo;
import org.dromara.mes.domain.bo.ProdBaseProdLineInfoBo;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.core.page.PageQuery;
import java.util.Collection;
import java.util.List;
/**
* 线Service
*
* @author Yinq
* @date 2025-01-06
*/
public interface IProdBaseProdLineInfoService {
/**
* 线
*
* @param prodLineId
* @return 线
*/
ProdBaseProdLineInfoVo queryById(Long prodLineId);
/**
* 线
*
* @param bo
* @param pageQuery
* @return 线
*/
TableDataInfo<ProdBaseProdLineInfoVo> queryPageList(ProdBaseProdLineInfoBo bo, PageQuery pageQuery);
/**
* 线
*
* @param bo
* @return 线
*/
List<ProdBaseProdLineInfoVo> queryList(ProdBaseProdLineInfoBo bo);
/**
* 线
*
* @param bo 线
* @return
*/
Boolean insertByBo(ProdBaseProdLineInfoBo bo);
/**
* 线
*
* @param bo 线
* @return
*/
Boolean updateByBo(ProdBaseProdLineInfoBo bo);
/**
* 线
*
* @param ids
* @param isValid
* @return
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
}

@ -78,7 +78,7 @@ public class ProdBaseFactoryInfoServiceImpl implements IProdBaseFactoryInfoServi
lqw.eq(StringUtils.isNotBlank(bo.getTimeZone()), ProdBaseFactoryInfo::getTimeZone, bo.getTimeZone());
lqw.eq(StringUtils.isNotBlank(bo.getFactoryStatus()), ProdBaseFactoryInfo::getFactoryStatus, bo.getFactoryStatus());
lqw.eq(StringUtils.isNotBlank(bo.getRemark()), ProdBaseFactoryInfo::getRemark, bo.getRemark());
lqw.orderByDesc(ProdBaseFactoryInfo::getCreateTime);
lqw.orderByAsc(ProdBaseFactoryInfo::getCreateTime);
return lqw;
}

@ -0,0 +1,140 @@
package org.dromara.mes.service.impl;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.core.page.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.toolkit.JoinWrappers;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.dromara.mes.domain.ProdBaseWorkshopInfo;
import org.springframework.stereotype.Service;
import org.dromara.mes.domain.bo.ProdBaseProdLineInfoBo;
import org.dromara.mes.domain.vo.ProdBaseProdLineInfoVo;
import org.dromara.mes.domain.ProdBaseProdLineInfo;
import org.dromara.mes.mapper.ProdBaseProdLineInfoMapper;
import org.dromara.mes.service.IProdBaseProdLineInfoService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
* 线Service
*
* @author Yinq
* @date 2025-01-06
*/
@RequiredArgsConstructor
@Service
public class ProdBaseProdLineInfoServiceImpl implements IProdBaseProdLineInfoService {
private final ProdBaseProdLineInfoMapper baseMapper;
/**
* 线
*
* @param prodLineId
* @return 线
*/
@Override
public ProdBaseProdLineInfoVo queryById(Long prodLineId){
return baseMapper.selectVoById(prodLineId);
}
/**
* 线
*
* @param bo
* @param pageQuery
* @return 线
*/
@Override
public TableDataInfo<ProdBaseProdLineInfoVo> queryPageList(ProdBaseProdLineInfoBo bo, PageQuery pageQuery) {
MPJLambdaWrapper<ProdBaseProdLineInfo> lqw = buildQueryWrapper(bo);
Page<ProdBaseProdLineInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
/**
* 线
*
* @param bo
* @return 线
*/
@Override
public List<ProdBaseProdLineInfoVo> queryList(ProdBaseProdLineInfoBo bo) {
MPJLambdaWrapper<ProdBaseProdLineInfo> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private MPJLambdaWrapper<ProdBaseProdLineInfo> buildQueryWrapper(ProdBaseProdLineInfoBo bo) {
Map<String, Object> params = bo.getParams();
MPJLambdaWrapper<ProdBaseProdLineInfo> lqw = JoinWrappers.lambda(ProdBaseProdLineInfo.class)
.selectAll(ProdBaseProdLineInfo.class)
.select(ProdBaseWorkshopInfo::getWorkshopName)
.leftJoin(ProdBaseWorkshopInfo.class, ProdBaseWorkshopInfo::getWorkshopId, ProdBaseProdLineInfo::getWorkshopId)
.eq(bo.getProdLineId() != null, ProdBaseProdLineInfo::getProdLineId, bo.getProdLineId())
.eq(StringUtils.isNotBlank(bo.getProdLineCode()), ProdBaseProdLineInfo::getProdLineCode, bo.getProdLineCode())
.like(StringUtils.isNotBlank(bo.getProdLineName()), ProdBaseProdLineInfo::getProdLineName, bo.getProdLineName())
.eq(StringUtils.isNotBlank(bo.getProdLineType()), ProdBaseProdLineInfo::getProdLineType, bo.getProdLineType())
.eq(bo.getWorkshopId() != null, ProdBaseProdLineInfo::getWorkshopId, bo.getWorkshopId())
.eq(StringUtils.isNotBlank(bo.getActiveFlag()), ProdBaseProdLineInfo::getActiveFlag, bo.getActiveFlag())
.orderByAsc(ProdBaseProdLineInfo::getCreateTime);
return lqw;
}
/**
* 线
*
* @param bo 线
* @return
*/
@Override
public Boolean insertByBo(ProdBaseProdLineInfoBo bo) {
ProdBaseProdLineInfo add = MapstructUtils.convert(bo, ProdBaseProdLineInfo.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setProdLineId(add.getProdLineId());
}
return flag;
}
/**
* 线
*
* @param bo 线
* @return
*/
@Override
public Boolean updateByBo(ProdBaseProdLineInfoBo bo) {
ProdBaseProdLineInfo update = MapstructUtils.convert(bo, ProdBaseProdLineInfo.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
*
*/
private void validEntityBeforeSave(ProdBaseProdLineInfo entity){
//TODO 做一些数据校验,如唯一约束
}
/**
* 线
*
* @param ids
* @param isValid
* @return
*/
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteByIds(ids) > 0;
}
}

@ -79,7 +79,7 @@ public class ProdBaseWorkshopInfoServiceImpl implements IProdBaseWorkshopInfoSer
.like(StringUtils.isNotBlank(bo.getWorkshopName()), ProdBaseWorkshopInfo::getWorkshopName, bo.getWorkshopName())
.eq(bo.getFactoryId() != null, ProdBaseWorkshopInfo::getFactoryId, bo.getFactoryId())
.eq(StringUtils.isNotBlank(bo.getActiveFlag()), ProdBaseWorkshopInfo::getActiveFlag, bo.getActiveFlag())
.orderByDesc(ProdBaseWorkshopInfo::getCreateTime);
.orderByAsc(ProdBaseWorkshopInfo::getCreateTime);
return lqw;
}

@ -0,0 +1,7 @@
<?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="org.dromara.mes.mapper.ProdBaseProdLineInfoMapper">
</mapper>
Loading…
Cancel
Save