add:基础分类,客户维护,设备维护
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
package org.nl.wms.basedata_manage.controller;
|
||||
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.basedata_manage.service.IMdPbClassstandardService;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPbClassstandard;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 基础分类表 控制层
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/Classstandard")
|
||||
@Slf4j
|
||||
public class ClassStandardController {
|
||||
|
||||
@Autowired
|
||||
private IMdPbClassstandardService iMdPbClassstandardService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询基础分类")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(iMdPbClassstandardService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增基础分类")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody MdPbClassstandard dto) {
|
||||
iMdPbClassstandardService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改基础分类")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody MdPbClassstandard dto) {
|
||||
iMdPbClassstandardService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除基础分类")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
iMdPbClassstandardService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/loadClass")
|
||||
@Log("查询基础类型")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson) {
|
||||
return new ResponseEntity<>(iMdPbClassstandardService.loadClass(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/superior")
|
||||
@Log("获取树形结构")
|
||||
public ResponseEntity<Object> getSuperior(@RequestBody String id) {
|
||||
MdPbClassstandard classDao = iMdPbClassstandardService.getById(id);
|
||||
List<MdPbClassstandard> superiorList = iMdPbClassstandardService.getSuperior(classDao, new ArrayList<>());
|
||||
return new ResponseEntity<>(iMdPbClassstandardService.buildTree(superiorList), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getClassName")
|
||||
@Log("获取分类名称下拉框")
|
||||
public ResponseEntity<Object> getClassName() {
|
||||
return new ResponseEntity<>(iMdPbClassstandardService.getClassName(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package org.nl.wms.basedata_manage.controller;
|
||||
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.basedata_manage.service.IMdCsCustomerbaseService;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdCsCustomerbase;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 客户信息表 控制层
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/customerbase")
|
||||
@Slf4j
|
||||
public class CustomerController {
|
||||
|
||||
@Autowired
|
||||
private IMdCsCustomerbaseService iMdCsCustomerbaseService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询客户")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(iMdCsCustomerbaseService.queryAll(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增客户")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody MdCsCustomerbase dto) {
|
||||
iMdCsCustomerbaseService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改客户")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody MdCsCustomerbase dto) {
|
||||
iMdCsCustomerbaseService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除客户")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
iMdCsCustomerbaseService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package org.nl.wms.basedata_manage.controller;
|
||||
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.basedata_manage.service.IEmBiDeviceinfoService;
|
||||
import org.nl.wms.basedata_manage.service.dao.EmBiDeviceinfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 设备基础信息表 控制层
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/deviceinfo")
|
||||
@Slf4j
|
||||
public class DeviceInfoController {
|
||||
|
||||
@Autowired
|
||||
private IEmBiDeviceinfoService iEmBiDeviceinfoService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询设备")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(iEmBiDeviceinfoService.queryAll(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增设备")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody EmBiDeviceinfo dto) {
|
||||
iEmBiDeviceinfoService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改设备")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody EmBiDeviceinfo dto) {
|
||||
iEmBiDeviceinfoService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除设备")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
iEmBiDeviceinfoService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package org.nl.wms.basedata_manage.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.basedata_manage.service.dao.EmBiDeviceinfo;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 生产设备基础信息表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
public interface IEmBiDeviceinfoService extends IService<EmBiDeviceinfo> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param whereJson : {查询参数}
|
||||
* @param pageable : 分页对象
|
||||
* @return 返回结果
|
||||
*/
|
||||
IPage<EmBiDeviceinfo> queryAll(Map whereJson, PageQuery pageable);
|
||||
|
||||
/**
|
||||
* 新增设备
|
||||
* @param dto 实体类
|
||||
*/
|
||||
void create(EmBiDeviceinfo dto);
|
||||
|
||||
/**
|
||||
* 修改设备
|
||||
* @param dto 实体类
|
||||
*/
|
||||
void update(EmBiDeviceinfo dto);
|
||||
|
||||
/**
|
||||
* 删除设备
|
||||
* @param ids 设备标识集合
|
||||
*/
|
||||
void delete(Set<String> ids);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package org.nl.wms.basedata_manage.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdCsCustomerbase;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 客户基本信息表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
public interface IMdCsCustomerbaseService extends IService<MdCsCustomerbase> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param whereJson : {查询参数}
|
||||
* @param pageable : 分页对象
|
||||
* @return 返回结果
|
||||
*/
|
||||
IPage<MdCsCustomerbase> queryAll(Map whereJson, PageQuery pageable);
|
||||
|
||||
/**
|
||||
* 新增客户
|
||||
* @param dto 实体类
|
||||
*/
|
||||
void create(MdCsCustomerbase dto);
|
||||
|
||||
/**
|
||||
* 修改客户
|
||||
* @param dto 实体类
|
||||
*/
|
||||
void update(MdCsCustomerbase dto);
|
||||
|
||||
/**
|
||||
* 删除客户
|
||||
* @param ids 客户标识集合
|
||||
*/
|
||||
void delete(Set<String> ids);
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package org.nl.wms.basedata_manage.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPbClassstandard;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 基础数据分类标准表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
public interface IMdPbClassstandardService extends IService<MdPbClassstandard> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param whereJson : {查询参数}
|
||||
* @param page : 分页对象
|
||||
* @return 返回结果
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 新增基础分类
|
||||
* @param dto 实体类
|
||||
*/
|
||||
void create(MdPbClassstandard dto);
|
||||
|
||||
/**
|
||||
* 修改基础分类
|
||||
* @param dto 物料实体类
|
||||
*/
|
||||
void update(MdPbClassstandard dto);
|
||||
|
||||
/**
|
||||
* 删除基础分类
|
||||
* @param ids 分类标识集合
|
||||
*/
|
||||
void delete(Set<String> ids);
|
||||
|
||||
/**
|
||||
* 查询基础类型
|
||||
* @param whereJson : 参数
|
||||
* @return JSONObject
|
||||
*/
|
||||
JSONObject loadClass(Map whereJson);
|
||||
|
||||
/**
|
||||
* 获取树形结构
|
||||
* @param classDao 实体类
|
||||
* @return List<MdPbClassstandard>
|
||||
*/
|
||||
List<MdPbClassstandard> getSuperior(MdPbClassstandard classDao, List<MdPbClassstandard> daoList);
|
||||
|
||||
/**
|
||||
* 处理树形结构
|
||||
* @param superiorList 实体类集合
|
||||
* @return JSONObject
|
||||
*/
|
||||
JSONObject buildTree(List<MdPbClassstandard> superiorList);
|
||||
|
||||
/**
|
||||
* 获取分类名称下拉框
|
||||
* @return List<JSONObject>
|
||||
*/
|
||||
List<JSONObject> getClassName();
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package org.nl.wms.basedata_manage.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 生产设备基础信息表
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("em_bi_deviceinfo")
|
||||
public class EmBiDeviceinfo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 设备标识
|
||||
*/
|
||||
@TableId(value = "device_id")
|
||||
private String device_id;
|
||||
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
private String device_code;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
private String device_name;
|
||||
|
||||
/**
|
||||
* 设备型号
|
||||
*/
|
||||
private String device_model;
|
||||
|
||||
/**
|
||||
* 设备规格
|
||||
*/
|
||||
private String device_specification;
|
||||
|
||||
/**
|
||||
* 供应商
|
||||
*/
|
||||
private String manufacturer;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private String is_used;
|
||||
|
||||
/**
|
||||
* 外部编码
|
||||
*/
|
||||
private String extend_code;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String create_id;
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
*/
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String update_optid;
|
||||
|
||||
/**
|
||||
* 修改人名称
|
||||
*/
|
||||
private String update_optname;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
|
||||
/**
|
||||
* 工厂
|
||||
*/
|
||||
private String factory;
|
||||
|
||||
/**
|
||||
* 生产规划
|
||||
*/
|
||||
private String manufactureplanning;
|
||||
|
||||
/**
|
||||
* 生产区域
|
||||
*/
|
||||
private String manufacturearea;
|
||||
|
||||
/**
|
||||
* 外部设备编码
|
||||
*/
|
||||
private String extend_code_mes;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
package org.nl.wms.basedata_manage.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 客户基本信息表
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("md_cs_customerbase")
|
||||
public class MdCsCustomerbase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 客户标识
|
||||
*/
|
||||
@TableId(value = "cust_id")
|
||||
private String cust_id;
|
||||
|
||||
/**
|
||||
* 客户编码
|
||||
*/
|
||||
private String cust_code;
|
||||
|
||||
/**
|
||||
* 客户名称
|
||||
*/
|
||||
private String cust_name;
|
||||
|
||||
/**
|
||||
* 客户简称
|
||||
*/
|
||||
private String cust_simple_name;
|
||||
|
||||
/**
|
||||
* 国家
|
||||
*/
|
||||
private String country;
|
||||
|
||||
/**
|
||||
* 省份
|
||||
*/
|
||||
private String state;
|
||||
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 传真
|
||||
*/
|
||||
private String faxnumber;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String webSite;
|
||||
|
||||
/**
|
||||
* 法人代表
|
||||
*/
|
||||
private String jurid_name;
|
||||
|
||||
/**
|
||||
* 税务登记号
|
||||
*/
|
||||
private String tax_no;
|
||||
|
||||
/**
|
||||
* 工商注册号
|
||||
*/
|
||||
private String register_no;
|
||||
|
||||
/**
|
||||
* 经营许可证号
|
||||
*/
|
||||
private String manage_lice_no;
|
||||
|
||||
/**
|
||||
* 营业执照
|
||||
*/
|
||||
private String busi_char_name;
|
||||
|
||||
/**
|
||||
* 邮政编码
|
||||
*/
|
||||
private String zip_code;
|
||||
|
||||
/**
|
||||
* 公司电话
|
||||
*/
|
||||
private String corp_tele_no;
|
||||
|
||||
/**
|
||||
* 公司地址
|
||||
*/
|
||||
private String corp_address;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String create_id;
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
*/
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String update_optid;
|
||||
|
||||
/**
|
||||
* 修改人姓名
|
||||
*/
|
||||
private String update_optname;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
/**
|
||||
* 启用时间
|
||||
*/
|
||||
private String is_used_time;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private String is_used;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
|
||||
/**
|
||||
* 外部标识
|
||||
*/
|
||||
private String ext_id;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package org.nl.wms.basedata_manage.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 基础数据分类标准表
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("md_pb_classstandard")
|
||||
public class MdPbClassstandard implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 分类标识
|
||||
*/
|
||||
@TableId(value = "class_id")
|
||||
private String class_id;
|
||||
|
||||
/**
|
||||
* 分类编码
|
||||
*/
|
||||
private String class_code;
|
||||
|
||||
/**
|
||||
* 分类长编码
|
||||
*/
|
||||
private String long_class_code;
|
||||
|
||||
/**
|
||||
* 分类名称
|
||||
*/
|
||||
private String class_name;
|
||||
|
||||
/**
|
||||
* 分类简要描述
|
||||
*/
|
||||
private String class_desc;
|
||||
|
||||
/**
|
||||
* 上级分类标识
|
||||
*/
|
||||
private String parent_class_id;
|
||||
|
||||
/**
|
||||
* 子部门数目
|
||||
*/
|
||||
private String sub_count;
|
||||
|
||||
/**
|
||||
* 是否叶子
|
||||
*/
|
||||
private String is_leaf;
|
||||
|
||||
/**
|
||||
* 是否可修改
|
||||
*/
|
||||
private String is_modify;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
|
||||
/**
|
||||
* 级别
|
||||
*/
|
||||
private String class_level;
|
||||
|
||||
/**
|
||||
* 外部标识
|
||||
*/
|
||||
private String ext_id;
|
||||
|
||||
/**
|
||||
* 外部上级标识
|
||||
*/
|
||||
private String ext_parent_id;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String create_id;
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
*/
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String update_optid;
|
||||
|
||||
/**
|
||||
* 修改人姓名
|
||||
*/
|
||||
private String update_optname;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.nl.wms.basedata_manage.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.wms.basedata_manage.service.dao.EmBiDeviceinfo;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 生产设备基础信息表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author author
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
public interface EmBiDeviceinfoMapper extends BaseMapper<EmBiDeviceinfo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?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.nl.wms.basedata_manage.service.dao.mapper.EmBiDeviceinfoMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.nl.wms.basedata_manage.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdCsCustomerbase;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 客户基本信息表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
public interface MdCsCustomerbaseMapper extends BaseMapper<MdCsCustomerbase> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?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.nl.wms.basedata_manage.service.dao.mapper.MdCsCustomerbaseMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.nl.wms.basedata_manage.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPbClassstandard;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 基础数据分类标准表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
public interface MdPbClassstandardMapper extends BaseMapper<MdPbClassstandard> {
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?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.nl.wms.basedata_manage.service.dao.mapper.MdPbClassstandardMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,147 @@
|
||||
package org.nl.wms.basedata_manage.service.dto;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 基础分类DTO
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
@Data
|
||||
public class ClassstandardDto {
|
||||
|
||||
/**
|
||||
* 分类标识
|
||||
*/
|
||||
private String class_id;
|
||||
|
||||
/**
|
||||
* 分类编码
|
||||
*/
|
||||
private String class_code;
|
||||
|
||||
/**
|
||||
* 分类长编码
|
||||
*/
|
||||
private String long_class_code;
|
||||
|
||||
/**
|
||||
* 分类名称
|
||||
*/
|
||||
private String class_name;
|
||||
|
||||
/**
|
||||
* 分类简要描述
|
||||
*/
|
||||
private String class_desc;
|
||||
|
||||
/**
|
||||
* 上级分类标识
|
||||
*/
|
||||
private String parent_class_id;
|
||||
|
||||
/**
|
||||
* 子部门数目
|
||||
*/
|
||||
private String sub_count;
|
||||
|
||||
/**
|
||||
* 是否叶子
|
||||
*/
|
||||
private String is_leaf;
|
||||
|
||||
/**
|
||||
* 是否可修改
|
||||
*/
|
||||
private String is_modify;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
|
||||
/**
|
||||
* 级别
|
||||
*/
|
||||
private String class_level;
|
||||
|
||||
/**
|
||||
* 外部标识
|
||||
*/
|
||||
private String ext_id;
|
||||
|
||||
/**
|
||||
* 外部上级标识
|
||||
*/
|
||||
private String ext_parent_id;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String create_id;
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
*/
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String update_optid;
|
||||
|
||||
/**
|
||||
* 修改人姓名
|
||||
*/
|
||||
private String update_optname;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
/**
|
||||
* 扩展属性1
|
||||
*/
|
||||
private Boolean hasChildren;
|
||||
|
||||
/**
|
||||
* 扩展属性2
|
||||
*/
|
||||
private Boolean leaf;
|
||||
|
||||
/**
|
||||
* 扩展属性3
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 扩展属性4
|
||||
*/
|
||||
private String label;
|
||||
|
||||
/**
|
||||
* 扩展属性5
|
||||
*/
|
||||
private String create_user_name;
|
||||
|
||||
/**
|
||||
* 扩展属性6
|
||||
*/
|
||||
private String update_user_name;
|
||||
|
||||
/**
|
||||
* 扩展属性7
|
||||
*/
|
||||
private JSONArray children;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package org.nl.wms.basedata_manage.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata_manage.enums.BaseDataEnum;
|
||||
import org.nl.wms.basedata_manage.service.IEmBiDeviceinfoService;
|
||||
import org.nl.wms.basedata_manage.service.dao.EmBiDeviceinfo;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.EmBiDeviceinfoMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 生产设备基础信息表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
@Service
|
||||
public class EmBiDeviceinfoServiceImpl extends ServiceImpl<EmBiDeviceinfoMapper, EmBiDeviceinfo> implements IEmBiDeviceinfoService {
|
||||
|
||||
@Override
|
||||
public IPage<EmBiDeviceinfo> queryAll(Map whereJson, PageQuery page) {
|
||||
// 查询条件
|
||||
LambdaQueryWrapper<EmBiDeviceinfo> queryWrapper = new QueryWrapper<EmBiDeviceinfo>().lambda();
|
||||
String search = MapUtil.getStr(whereJson, "search");
|
||||
|
||||
if (ObjectUtil.isNotEmpty(search)) {
|
||||
queryWrapper.likeRight(EmBiDeviceinfo::getDevice_code, search)
|
||||
.or(item -> item.likeRight(EmBiDeviceinfo::getDevice_name, search));
|
||||
}
|
||||
queryWrapper.eq(EmBiDeviceinfo::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
queryWrapper.orderByDesc(EmBiDeviceinfo::getUpdate_time);
|
||||
|
||||
return this.baseMapper.selectPage(new Page<>(page.getPage() + 1, page.getSize()),
|
||||
queryWrapper
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(EmBiDeviceinfo dto) {
|
||||
EmBiDeviceinfo emBiDeviceinfo = this.baseMapper.selectOne(
|
||||
new QueryWrapper<EmBiDeviceinfo>().lambda()
|
||||
.eq(EmBiDeviceinfo::getDevice_code, dto.getDevice_code())
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(emBiDeviceinfo)) {
|
||||
throw new BadRequestException("当前设备编码已存在【"+dto.getDevice_code()+"】");
|
||||
}
|
||||
|
||||
// 新增
|
||||
dto.setDevice_id(IdUtil.getStringId());
|
||||
dto.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
dto.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
dto.setCreate_time(DateUtil.now());
|
||||
dto.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
dto.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
dto.setUpdate_time(DateUtil.now());
|
||||
this.save(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(EmBiDeviceinfo dto) {
|
||||
EmBiDeviceinfo emBiDeviceinfo = this.baseMapper.selectById(dto.getDevice_id());
|
||||
if (ObjectUtil.isEmpty(emBiDeviceinfo)) {
|
||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
}
|
||||
|
||||
// 修改
|
||||
dto.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
dto.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
dto.setUpdate_time(DateUtil.now());
|
||||
this.updateById(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(Set<String> ids) {
|
||||
this.baseMapper.deleteBatchIds(ids);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package org.nl.wms.basedata_manage.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata_manage.enums.BaseDataEnum;
|
||||
import org.nl.wms.basedata_manage.service.IMdCsCustomerbaseService;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdCsCustomerbase;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdCsCustomerbaseMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 客户基本信息表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
@Service
|
||||
public class MdCsCustomerbaseServiceImpl extends ServiceImpl<MdCsCustomerbaseMapper, MdCsCustomerbase> implements IMdCsCustomerbaseService {
|
||||
|
||||
@Override
|
||||
public IPage<MdCsCustomerbase> queryAll(Map whereJson, PageQuery page) {
|
||||
// 查询条件
|
||||
LambdaQueryWrapper<MdCsCustomerbase> queryWrapper = new QueryWrapper<MdCsCustomerbase>().lambda();
|
||||
String search = MapUtil.getStr(whereJson, "search");
|
||||
|
||||
if (ObjectUtil.isNotEmpty(search)) {
|
||||
queryWrapper.likeRight(MdCsCustomerbase::getCust_code, search)
|
||||
.or(item -> item.likeRight(MdCsCustomerbase::getCust_name, search));
|
||||
}
|
||||
queryWrapper.eq(MdCsCustomerbase::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
queryWrapper.orderByDesc(MdCsCustomerbase::getUpdate_time);
|
||||
|
||||
return this.baseMapper.selectPage(new Page<>(page.getPage() + 1, page.getSize()),
|
||||
queryWrapper
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(MdCsCustomerbase dto) {
|
||||
MdCsCustomerbase mdCsCustomerbase = this.baseMapper.selectOne(
|
||||
new QueryWrapper<MdCsCustomerbase>().lambda()
|
||||
.eq(MdCsCustomerbase::getCust_code, dto.getCust_code())
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(mdCsCustomerbase)) {
|
||||
throw new BadRequestException("当前客户编码已存在【"+dto.getCust_code()+"】");
|
||||
}
|
||||
|
||||
// 新增
|
||||
dto.setCust_id(IdUtil.getStringId());
|
||||
dto.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
dto.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
dto.setCreate_time(DateUtil.now());
|
||||
dto.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
dto.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
dto.setUpdate_time(DateUtil.now());
|
||||
this.save(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(MdCsCustomerbase dto) {
|
||||
MdCsCustomerbase mdCsCustomerbase = this.baseMapper.selectById(dto.getCust_id());
|
||||
if (ObjectUtil.isEmpty(mdCsCustomerbase)) {
|
||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
}
|
||||
|
||||
// 修改
|
||||
dto.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
dto.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
dto.setUpdate_time(DateUtil.now());
|
||||
this.updateById(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(Set<String> ids) {
|
||||
this.baseMapper.deleteBatchIds(ids);
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public class MdCsSupplierbaseServiceImpl extends ServiceImpl<MdCsSupplierbaseMap
|
||||
.eq(MdCsSupplierbase::getSupp_code, dto.getSupp_code())
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(mdCsSupplierbase)) {
|
||||
throw new BadRequestException("当前计量单位编码已存在【"+dto.getSupp_code()+"】");
|
||||
throw new BadRequestException("当前供应商编码已存在【"+dto.getSupp_code()+"】");
|
||||
}
|
||||
|
||||
// 新增
|
||||
|
||||
@@ -0,0 +1,345 @@
|
||||
package org.nl.wms.basedata_manage.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.PageUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata_manage.enums.BaseDataEnum;
|
||||
import org.nl.wms.basedata_manage.service.IMdPbClassstandardService;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPbClassstandard;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbClassstandardMapper;
|
||||
import org.nl.wms.basedata_manage.service.dto.ClassstandardDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 基础数据分类标准表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
@Service
|
||||
public class MdPbClassstandardServiceImpl extends ServiceImpl<MdPbClassstandardMapper, MdPbClassstandard> implements IMdPbClassstandardService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object>queryAll(Map whereJson, Pageable page) {
|
||||
// 查询所有分类
|
||||
String class_code = MapUtil.getStr(whereJson, "class_code");
|
||||
LambdaQueryWrapper<MdPbClassstandard> lambda = new QueryWrapper<MdPbClassstandard>().lambda();
|
||||
lambda.eq(MdPbClassstandard::getParent_class_id, null)
|
||||
.or(item -> item.eq(MdPbClassstandard::getParent_class_id, BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
);
|
||||
lambda.eq(MdPbClassstandard::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
if (ObjectUtil.isNotEmpty(class_code)) {
|
||||
lambda.eq(MdPbClassstandard::getClass_code, class_code);
|
||||
}
|
||||
lambda.orderByDesc(MdPbClassstandard::getUpdate_time);
|
||||
|
||||
// 处理后的数据
|
||||
List<ClassstandardDto> dtoList = new ArrayList<>();
|
||||
// 处理数据
|
||||
List<MdPbClassstandard> classList = this.list(lambda);
|
||||
for (MdPbClassstandard dao : classList) {
|
||||
ClassstandardDto dto = JSONObject.parseObject(JSONObject.toJSONString(dao), ClassstandardDto.class);
|
||||
|
||||
if (Integer.parseInt(dto.getSub_count()) > 0) {
|
||||
dto.setHasChildren(true);
|
||||
dto.setLeaf(false);
|
||||
} else {
|
||||
dto.setHasChildren(false);
|
||||
dto.setLeaf(true);
|
||||
}
|
||||
dto.setId(dto.getClass_id());
|
||||
dto.setLabel(dto.getClass_name());
|
||||
dtoList.add(dto);
|
||||
}
|
||||
|
||||
// 组织分页查询并返回
|
||||
Map<String, Object> json = PageUtil.toPage(
|
||||
PageUtil.toPage(page.getPageNumber(), page.getPageSize(), dtoList),
|
||||
dtoList.size()
|
||||
);
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(MdPbClassstandard dto) {
|
||||
MdPbClassstandard mdPbClassstandard = this.baseMapper.selectOne(
|
||||
new QueryWrapper<MdPbClassstandard>().lambda()
|
||||
.eq(MdPbClassstandard::getClass_code, dto.getClass_code())
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(mdPbClassstandard)) {
|
||||
throw new BadRequestException("当前分类编码已存在【"+dto.getClass_code()+"】");
|
||||
}
|
||||
// 新增
|
||||
dto.setClass_id(IdUtil.getStringId());
|
||||
dto.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
dto.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
dto.setCreate_time(DateUtil.now());
|
||||
dto.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
dto.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
dto.setUpdate_time(DateUtil.now());
|
||||
dto.setIs_leaf(BaseDataEnum.IS_YES_NOT.code("是"));
|
||||
dto.setClass_level(Math.ceil(dto.getClass_code().length() / 2.0) + "");
|
||||
dto.setSub_count(BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
dto.setLong_class_code(dto.getClass_code());
|
||||
this.save(dto);
|
||||
|
||||
// 更新节点
|
||||
if (ObjectUtil.isNotEmpty(dto.getParent_class_id())) {
|
||||
updateSubCnt(dto.getParent_class_id());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(MdPbClassstandard dto) {
|
||||
MdPbClassstandard mdPbClassstandard = this.baseMapper.selectById(dto.getClass_id());
|
||||
if (ObjectUtil.isEmpty(mdPbClassstandard)) {
|
||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
}
|
||||
|
||||
if ( ObjectUtil.isNotEmpty(dto.getParent_class_id()) && dto.getClass_id().equals(dto.getParent_class_id())) {
|
||||
throw new BadRequestException("上级不能为自己");
|
||||
}
|
||||
|
||||
// 修改
|
||||
dto.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
dto.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
dto.setUpdate_time(DateUtil.now());
|
||||
this.updateById(dto);
|
||||
|
||||
//更新父节点中子节点数目
|
||||
updateSubCnt(mdPbClassstandard.getParent_class_id());
|
||||
updateSubCnt(dto.getClass_id());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(Set<String> ids) {
|
||||
// 查询所有数据
|
||||
List<MdPbClassstandard> daoList = this.list(
|
||||
new QueryWrapper<MdPbClassstandard>().lambda()
|
||||
.eq(MdPbClassstandard::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
);
|
||||
|
||||
for (String class_id : ids) {
|
||||
MdPbClassstandard mdPbClassstandard = daoList.stream()
|
||||
.filter(item -> item.getClass_id().equals(class_id))
|
||||
.findFirst().orElse(null);
|
||||
mdPbClassstandard.setIs_delete(BaseDataEnum.IS_YES_NOT.code("是"));
|
||||
this.baseMapper.updateById(mdPbClassstandard);
|
||||
|
||||
List<MdPbClassstandard> parentList = daoList.stream()
|
||||
.filter(item -> item.getParent_class_id().equals(class_id))
|
||||
.collect(Collectors.toList());
|
||||
if (ObjectUtil.isNotEmpty(parentList)) {
|
||||
Set<String> child_ids = new HashSet<>();
|
||||
|
||||
for (int i = 0; i < parentList.size(); i++) {
|
||||
MdPbClassstandard child_row = parentList.get(i);
|
||||
child_ids.add(child_row.getClass_id());
|
||||
}
|
||||
this.delete(child_ids);
|
||||
}
|
||||
updateSubCnt(mdPbClassstandard.getParent_class_id());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject loadClass(Map whereJson) {
|
||||
String pid = MapUtil.getStr(whereJson, "pid");
|
||||
// 查询条件
|
||||
LambdaQueryWrapper<MdPbClassstandard> lambda = new QueryWrapper<MdPbClassstandard>().lambda();
|
||||
if (ObjectUtil.isEmpty(pid) || pid.equals(BaseDataEnum.IS_YES_NOT.code("否")) ) {
|
||||
lambda.eq(MdPbClassstandard::getParent_class_id, BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
.or(item -> item.eq(MdPbClassstandard::getParent_class_id, null));
|
||||
lambda.eq(MdPbClassstandard::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
lambda.orderByAsc(MdPbClassstandard::getClass_id);
|
||||
} else {
|
||||
lambda.eq(MdPbClassstandard::getParent_class_id, pid)
|
||||
.eq(MdPbClassstandard::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
lambda.orderByAsc(MdPbClassstandard::getClass_id);
|
||||
}
|
||||
|
||||
// 定义需返回的集合
|
||||
List<ClassstandardDto> dtoList = new ArrayList<>();
|
||||
|
||||
List<MdPbClassstandard> daoList = this.list(lambda);
|
||||
for (MdPbClassstandard dao : daoList) {
|
||||
// 类型转换
|
||||
ClassstandardDto dto = JSONObject.parseObject(JSONObject.toJSONString(dao), ClassstandardDto.class);
|
||||
|
||||
if (Integer.parseInt(dto.getSub_count()) > 0) {
|
||||
dto.setHasChildren(true);
|
||||
dto.setLeaf(false);
|
||||
} else {
|
||||
dto.setHasChildren(false);
|
||||
dto.setLeaf(true);
|
||||
}
|
||||
dto.setId(dto.getClass_id());
|
||||
dto.setLabel(dto.getClass_name());
|
||||
dto.setCreate_user_name(dto.getCreate_name());
|
||||
dto.setUpdate_user_name(dto.getUpdate_optname());
|
||||
dtoList.add(dto);
|
||||
}
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("content", dtoList);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MdPbClassstandard> getSuperior(MdPbClassstandard classDao, List<MdPbClassstandard> daoList) {
|
||||
if (ObjectUtil.isEmpty(classDao.getParent_class_id()) || classDao.getParent_class_id().equals(BaseDataEnum.IS_YES_NOT.code("否"))) {
|
||||
List<MdPbClassstandard> list = this.list(
|
||||
new QueryWrapper<MdPbClassstandard>().lambda()
|
||||
.eq(MdPbClassstandard::getParent_class_id, BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
.or(item -> item.eq(MdPbClassstandard::getParent_class_id, null))
|
||||
.eq(MdPbClassstandard::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
);
|
||||
daoList.addAll(list);
|
||||
return daoList;
|
||||
}
|
||||
|
||||
List<MdPbClassstandard> list = this.list(
|
||||
new QueryWrapper<MdPbClassstandard>().lambda()
|
||||
.eq(MdPbClassstandard::getParent_class_id, classDao.getParent_class_id())
|
||||
);
|
||||
daoList.addAll(list);
|
||||
MdPbClassstandard pidDao = this.getById(classDao.getParent_class_id());
|
||||
return getSuperior(pidDao,daoList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject buildTree(List<MdPbClassstandard> superiorList) {
|
||||
Set<ClassstandardDto> trees = new LinkedHashSet<>();
|
||||
Set<ClassstandardDto> maters = new LinkedHashSet<>();
|
||||
List<String> mater_name = new LinkedList<>();
|
||||
superiorList.forEach(item -> {
|
||||
mater_name.add(item.getClass_name());
|
||||
});
|
||||
|
||||
boolean isChild;
|
||||
for (MdPbClassstandard dao : superiorList) {
|
||||
ClassstandardDto dto1 = JSONObject.parseObject(JSONObject.toJSONString(dao), ClassstandardDto.class);
|
||||
isChild = false;
|
||||
if (dto1.getParent_class_id().equals(BaseDataEnum.IS_YES_NOT.code("否")) || ObjectUtil.isEmpty(dto1.getParent_class_id())) {
|
||||
dto1.setId(dto1.getClass_id());
|
||||
dto1.setLabel(dto1.getClass_name());
|
||||
if (Integer.parseInt(dto1.getSub_count()) > 0) {
|
||||
dto1.setHasChildren(true);
|
||||
dto1.setLeaf(false);
|
||||
} else {
|
||||
dto1.setHasChildren(false);
|
||||
dto1.setLeaf(true);
|
||||
}
|
||||
trees.add(dto1);
|
||||
}
|
||||
|
||||
for (MdPbClassstandard dao2 : superiorList) {
|
||||
ClassstandardDto dto2 = JSONObject.parseObject(JSONObject.toJSONString(dao2), ClassstandardDto.class);
|
||||
if (!dto2.getClass_id().equals(BaseDataEnum.IS_YES_NOT.code("否")) && dto1.getClass_id().equals(dto2.getParent_class_id())) {
|
||||
isChild = true;
|
||||
if (ObjectUtil.isEmpty(dto1.getChildren())) {
|
||||
dto1.setChildren(new JSONArray());
|
||||
}
|
||||
JSONArray child_ja = dto1.getChildren();
|
||||
dto2.setId(dto2.getClass_id());
|
||||
dto2.setLabel(dto2.getClass_name());
|
||||
if (Integer.parseInt(dto2.getSub_count()) > 0) {
|
||||
dto2.setHasChildren(true);
|
||||
dto2.setLeaf(false);
|
||||
} else {
|
||||
dto2.setHasChildren(false);
|
||||
dto2.setLeaf(true);
|
||||
}
|
||||
child_ja.add(dto2);
|
||||
}
|
||||
}
|
||||
if (isChild) {
|
||||
dto1.setId(dto1.getClass_id());
|
||||
dto1.setLabel(dto1.getClass_name());
|
||||
if (Integer.parseInt(dto1.getSub_count()) > 0) {
|
||||
dto1.setHasChildren(true);
|
||||
dto1.setLeaf(false);
|
||||
} else {
|
||||
dto1.setHasChildren(false);
|
||||
dto1.setLeaf(true);
|
||||
}
|
||||
maters.add(dto1);
|
||||
} else if (!dto1.getClass_id().equals(BaseDataEnum.IS_YES_NOT.code("否"))) {
|
||||
dto1.setId(dto1.getClass_id());
|
||||
dto1.setLabel(dto1.getClass_name());
|
||||
if (Integer.parseInt(dto1.getSub_count()) > 0) {
|
||||
dto1.setHasChildren(true);
|
||||
dto1.setLeaf(false);
|
||||
} else {
|
||||
dto1.setHasChildren(false);
|
||||
dto1.setLeaf(true);
|
||||
}
|
||||
maters.add(dto1);
|
||||
}
|
||||
}
|
||||
if (maters.size() == 0) {
|
||||
maters = trees;
|
||||
}
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("totalElements", superiorList.size());
|
||||
jo.put("content", maters.size() == 0 ? superiorList : trees);
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> getClassName() {
|
||||
List<MdPbClassstandard> daoList = this.list(
|
||||
new QueryWrapper<MdPbClassstandard>().lambda()
|
||||
.eq(MdPbClassstandard::getParent_class_id, null)
|
||||
.or(item -> item.eq(MdPbClassstandard::getParent_class_id, BaseDataEnum.IS_YES_NOT.code("否")))
|
||||
.eq(MdPbClassstandard::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
);
|
||||
|
||||
List<JSONObject> result = new ArrayList<>();
|
||||
daoList.forEach(row -> {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("label", row.getClass_name());
|
||||
json.put("value", row.getClass_code());
|
||||
result.add(json);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新节点
|
||||
* @param parent_class_id 父级id
|
||||
*/
|
||||
private void updateSubCnt(String parent_class_id) {
|
||||
if (ObjectUtil.isNotEmpty(parent_class_id) && !parent_class_id.equals(BaseDataEnum.IS_YES_NOT.code("否"))) {
|
||||
int count = this.baseMapper.selectCount(
|
||||
new QueryWrapper<MdPbClassstandard>().lambda()
|
||||
.eq(MdPbClassstandard::getParent_class_id, parent_class_id)
|
||||
.eq(MdPbClassstandard::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
);
|
||||
|
||||
MdPbClassstandard pidDao = this.getById(parent_class_id);
|
||||
pidDao.setSub_count(String.valueOf(count));
|
||||
pidDao.setIs_leaf(count > 0 ? BaseDataEnum.IS_YES_NOT.code("否") : BaseDataEnum.IS_YES_NOT.code("是"));
|
||||
this.updateById(pidDao);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user