Merge remote-tracking branch 'origin/branch_syruan'

This commit is contained in:
syruan 2024-10-16 09:18:33 +08:00
commit 255a346490
38 changed files with 1077 additions and 424 deletions

View File

@ -0,0 +1,56 @@
package com.bonus.common.biz.domain;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* TreeSelect树结构实体类
* @author syruan
*/
@Data
public class TreeSelect implements Serializable {
private static final long serialVersionUID = 469203039368157600L;
/** 节点ID */
private Long id;
/** 节点名称 */
private String label;
/** 节点级别 */
private Integer level;
/** 父节点id */
private Long parentId;
/** 公司id */
private String companyId;
/** 子节点集合 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<TreeSelect> children;
public TreeSelect() {
}
public TreeSelect(Long id, String label, Integer level, Long parentId, List<TreeSelect> children) {
this.id = id;
this.label = label;
this.level = level;
this.parentId = parentId;
this.children = children;
}
public TreeSelect(Long id, String label, Integer level, Long parentId) {
this.id = id;
this.label = label;
this.level = level;
this.parentId = parentId;
}
}

View File

@ -0,0 +1,26 @@
package com.bonus.common.biz.enums;
import lombok.Getter;
/**
* @author : 阮世耀
* @version : 1.0
* @PackagePath: com.bonus.common.biz.enums
* @CreateTime: 2024-10-15 10:28
* @Description: 数据状态枚举类
*/
@Getter
public enum DataCodeEnum {
NORMAL(0, "正常"),
DELETED(2, "已删除");
private final int code;
private final String msg;
DataCodeEnum(int code, String msg) {
this.code = code;
this.msg = msg;
}
}

View File

@ -1,5 +1,12 @@
package com.bonus.common.biz.enums;
import lombok.Getter;
/**
* @author bonus
*/
@Getter
public enum HttpCodeEnum {
// 成功
SUCCESS(200, "操作成功"),
@ -20,19 +27,13 @@ public enum HttpCodeEnum {
NICKNAME_EXIST(512, "昵称已存在"),
LOGIN_ERROR(505, "用户名或密码错误"),
REPEATE_ERROR(600, "不允许重复提交,请稍候再试");
int code;
String msg;
private final int code;
private final String msg;
HttpCodeEnum(int code, String errorMessage) {
this.code = code;
this.msg = errorMessage;
}
public int getCode() {
return code;
}
public String getMsg() {
return msg;
}
}

View File

@ -33,8 +33,8 @@ import com.bonus.common.core.web.page.TableDataInfo;
@Api(tags = "机具设备管理接口")
@RestController
@RequestMapping("/ma_machine")
public class MachineController extends BaseController
{
public class MachineController extends BaseController {
@Autowired
private IMachineService machineService;

View File

@ -1,6 +1,7 @@
package com.bonus.material.ma.controller;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import com.bonus.common.log.enums.OperaType;
import com.bonus.material.common.annotation.PreventRepeatSubmit;
@ -25,94 +26,86 @@ import com.bonus.common.core.utils.poi.ExcelUtil;
import com.bonus.common.core.web.page.TableDataInfo;
/**
* 供应商管理Controller
*
* @author xsheng
* @date 2024-09-27
* 物资厂家管理Controller
* @author bonus
*/
@Api(tags = "供应商管理接口")
@Api(tags = "物资厂家管理接口")
@RestController
@RequestMapping("/ma_supplier_info")
public class SupplierInfoController extends BaseController
{
@Autowired
public class SupplierInfoController extends BaseController {
@Resource
private ISupplierInfoService supplierInfoService;
/**
* 查询供应商管理列表
* 查询物资厂家管理列表
*/
@ApiOperation(value = "查询供应商管理列表")
@ApiOperation(value = "查询物资厂家管理列表")
@RequiresPermissions("ma:info:list")
@GetMapping("/list")
public TableDataInfo list(SupplierInfo supplierInfo)
{
public TableDataInfo list(SupplierInfo supplierInfo) {
startPage();
List<SupplierInfo> list = supplierInfoService.selectSupplierInfoList(supplierInfo);
return getDataTable(list);
}
/**
* 导出供应商管理列表
* 导出物资厂家管理列表
*/
@ApiOperation(value = "导出供应商管理列表")
@ApiOperation(value = "导出物资厂家管理列表")
@PreventRepeatSubmit
@RequiresPermissions("ma:info:export")
@SysLog(title = "供应商管理", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出供应商管理")
@SysLog(title = "物资厂家管理", businessType = OperaType.EXPORT, logType = 1,module = "物资管理->导出物资厂家管理")
@PostMapping("/export")
public void export(HttpServletResponse response, SupplierInfo supplierInfo)
{
public void export(HttpServletResponse response, SupplierInfo supplierInfo) {
List<SupplierInfo> list = supplierInfoService.selectSupplierInfoList(supplierInfo);
ExcelUtil<SupplierInfo> util = new ExcelUtil<SupplierInfo>(SupplierInfo.class);
util.exportExcel(response, list, "供应商管理数据");
ExcelUtil<SupplierInfo> util = new ExcelUtil<>(SupplierInfo.class);
util.exportExcel(response, list, "物资厂家管理数据");
}
/**
* 获取供应商管理详细信息
* 获取物资厂家管理详细信息
*/
@ApiOperation(value = "获取供应商管理详细信息")
@ApiOperation(value = "获取物资厂家管理详细信息")
@RequiresPermissions("ma:info:query")
@GetMapping(value = "/{supplierId}")
public AjaxResult getInfo(@PathVariable("supplierId") Long supplierId)
{
public AjaxResult getInfo(@PathVariable("supplierId") Long supplierId) {
return success(supplierInfoService.selectSupplierInfoBySupplierId(supplierId));
}
/**
* 新增供应商管理
* 新增物资厂家管理
*/
@ApiOperation(value = "新增供应商管理")
@ApiOperation(value = "新增物资厂家管理")
@PreventRepeatSubmit
@RequiresPermissions("ma:info:add")
@SysLog(title = "供应商管理", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增供应商管理")
@SysLog(title = "物资厂家管理", businessType = OperaType.INSERT, module = "物资管理->新增物资厂家管理")
@PostMapping
public AjaxResult add(@RequestBody SupplierInfo supplierInfo)
{
public AjaxResult add(@RequestBody SupplierInfo supplierInfo) {
return toAjax(supplierInfoService.insertSupplierInfo(supplierInfo));
}
/**
* 修改供应商管理
* 修改物资厂家管理
*/
@ApiOperation(value = "修改供应商管理")
@ApiOperation(value = "修改物资厂家管理")
@PreventRepeatSubmit
@RequiresPermissions("ma:info:edit")
@SysLog(title = "供应商管理", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改供应商管理")
@SysLog(title = "物资厂家管理", businessType = OperaType.UPDATE, module = "物资管理->修改物资厂家管理")
@PutMapping
public AjaxResult edit(@RequestBody SupplierInfo supplierInfo)
{
public AjaxResult edit(@RequestBody SupplierInfo supplierInfo) {
return toAjax(supplierInfoService.updateSupplierInfo(supplierInfo));
}
/**
* 删除供应商管理
* 删除物资厂家管理
*/
@ApiOperation(value = "删除供应商管理")
@ApiOperation(value = "删除物资厂家管理")
@PreventRepeatSubmit
@RequiresPermissions("ma:info:remove")
@SysLog(title = "供应商管理", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除供应商管理")
@SysLog(title = "物资厂家管理", businessType = OperaType.DELETE, module = "物资管理->删除物资厂家管理")
@DeleteMapping("/{supplierIds}")
public AjaxResult remove(@PathVariable Long[] supplierIds)
{
public AjaxResult remove(@PathVariable Long[] supplierIds) {
return toAjax(supplierInfoService.deleteSupplierInfoBySupplierIds(supplierIds));
}
}

View File

@ -1,20 +1,22 @@
package com.bonus.material.ma.controller;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import com.bonus.common.log.enums.OperaType;
import com.bonus.material.common.annotation.PreventRepeatSubmit;
import com.bonus.common.biz.domain.TreeSelect;
import com.bonus.material.ma.vo.MaTypeListVo;
import com.bonus.material.ma.vo.MaTypeSelectVo;
import com.bonus.material.warehouse.domain.WhHouseSet;
import com.bonus.material.warehouse.service.IWhHouseSetService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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 org.springframework.web.bind.annotation.*;
import com.bonus.common.log.annotation.SysLog;
import com.bonus.common.security.annotation.RequiresPermissions;
import com.bonus.material.ma.domain.Type;
@ -25,94 +27,165 @@ import com.bonus.common.core.utils.poi.ExcelUtil;
import com.bonus.common.core.web.page.TableDataInfo;
/**
* 机具类型管理Controller
*
* @author xsheng
* @date 2024-09-27
* 物资类型管理Controller
* @author syruan
*/
@Api(tags = "机具类型管理接口")
@Api(tags = "物资类型管理接口")
@RestController
@RequestMapping("/ma_type")
public class TypeController extends BaseController
{
@Autowired
public class TypeController extends BaseController {
@Resource
private ITypeService typeService;
@Resource
private IWhHouseSetService houseSetService;
/**
* 查询机具类型管理列表
* 查询物资类型管理列表
*/
@ApiOperation(value = "查询机具类型管理列表")
@ApiOperation(value = "查询物资类型管理列表")
@RequiresPermissions("ma:type:list")
@GetMapping("/list")
public TableDataInfo list(Type type)
{
public TableDataInfo list(MaTypeListVo type) {
startPage();
List<Type> list = typeService.selectTypeList(type);
List<MaTypeListVo> list = typeService.selectTypeListAndParent(type);
return getDataTable(list);
}
/**
* 导出机具类型管理列表
* 根据物资仓库ID查询施工类型
*/
@ApiOperation(value = "导出机具类型管理列表")
@PreventRepeatSubmit
@RequiresPermissions("ma:type:export")
@SysLog(title = "机具类型管理", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出机具类型管理")
@PostMapping("/export")
public void export(HttpServletResponse response, Type type)
{
List<Type> list = typeService.selectTypeList(type);
ExcelUtil<Type> util = new ExcelUtil<Type>(Type.class);
util.exportExcel(response, list, "机具类型管理数据");
@ApiOperation(value = "根据物资仓库ID查询施工类型")
@RequiresPermissions("ma:type:list")
@GetMapping("/selectMaTypeListByHouseId")
public AjaxResult selectMaTypeListByHouseId(@NotNull(message = "物资仓库ID不能为空") Long houseId) {
List<MaTypeSelectVo> list = typeService.selectMaTypeListByHouseId(houseId);
return success(list);
}
/**
* 获取机具类型管理详细信息
* 根据物资类型ID查询子级下拉列表 --不进行递归穿透
*/
@ApiOperation(value = "获取机具类型管理详细信息")
@ApiOperation(value = "根据物资类型ID-查询子级下拉列表")
@RequiresPermissions("ma:type:list")
@GetMapping("/selectMaTypeListByTypeId")
public AjaxResult selectMaTypeListByTypeId(@NotNull(message = "物资类型ID不能为空") Long typeId) {
List<MaTypeSelectVo> list = typeService.getMaTypeSelectVoListByParentId(typeId);
return success(list);
}
/**
* 根据左列表类型id查询右表格 --- 暂未启用代码有问题!!
* TODO: 待完善
* @param typeId 左列表类型id
*/
@ApiOperation(value = "根据左列表类型id查询右表格")
@GetMapping("/getListByMaType")
public AjaxResult getListByMaType(Long typeId, @RequestParam(required = false) String typeName, Integer level) {
List<Integer> parentIds = typeService.selectParentId(typeId, level);
List<Type> listByMaType = new ArrayList<>();
for (Integer parentId : parentIds) {
listByMaType.addAll(typeService.getListByParentId(parentId.longValue(), typeName));
}
// Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
// Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
// return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, listByMaType));
return null;
}
/**
* TODO : 后续优化代码逻辑
* 物资类型下拉树
*/
@ApiOperation(value = "物资类型下拉树")
@RequiresPermissions("ma:type:list")
@GetMapping("/getMaTypeTreeSelect")
public AjaxResult getMaTypeTreeSelect(@RequestParam(required = false, defaultValue = "", value = "typeName") String typeName, @RequestParam(required = false, defaultValue = "", value = "parentId") String parentId) {
// 1.顶级节点及子节点数据全部查询完毕
List<TreeSelect> maTypeList = typeService.getMaTypeTree(typeName, parentId);
// 2.查询所有的仓库配置
List<WhHouseSet> whHouseSets = houseSetService.selectListByMaType(null);
// 2.1 定义最终接口返回集合
List<TreeSelect> treeSelectResultList = new ArrayList<>();
// 3.遍历所有配置关联
for (WhHouseSet whHouseSet : whHouseSets) {
Long typeId = whHouseSet.getTypeId();
if (typeId == null) {continue;}
// 构造函数定义0级Tree对象
TreeSelect thisTree = new TreeSelect(whHouseSet.getId(),whHouseSet.getHouseName(),0,null);
// 定义1级列表并循环push相应的1级节点
List<TreeSelect> oneLevelTreeList = new ArrayList<>();
for (TreeSelect treeSelect : maTypeList) {
if (treeSelect.getId().equals(typeId)) {
oneLevelTreeList.add(treeSelect);
}
}
// 把处理后对应上的1级列表当作child存入0级Tree对象中
thisTree.setChildren(!oneLevelTreeList.isEmpty() ? oneLevelTreeList : null);
// 最后把0级Tree对象存入Result返回集合中返回给前端
treeSelectResultList.add(thisTree);
}
return AjaxResult.success(treeSelectResultList);
}
/**
* 导出物资类型管理列表
*/
@ApiOperation(value = "导出物资类型列表")
@PreventRepeatSubmit
@RequiresPermissions("ma:type:export")
@SysLog(title = "物资类型管理", businessType = OperaType.EXPORT, module = "仓储管理->导出物资类型")
@PostMapping("/export")
public void export(HttpServletResponse response, Type type) {
List<Type> list = typeService.selectTypeList(type);
ExcelUtil<Type> util = new ExcelUtil<Type>(Type.class);
util.exportExcel(response, list, "物资类型管理数据");
}
/**
* 获取物资类型管理详细信息
*/
@ApiOperation(value = "获取物资类型详细信息")
@RequiresPermissions("ma:type:query")
@GetMapping(value = "/{typeId}")
public AjaxResult getInfo(@PathVariable("typeId") Long typeId)
{
public AjaxResult getInfo(@PathVariable("typeId") Long typeId) {
return success(typeService.selectTypeByTypeId(typeId));
}
/**
* 新增机具类型管理
* 新增物资类型管理
*/
@ApiOperation(value = "新增机具类型管理")
@ApiOperation(value = "新增物资类型")
@PreventRepeatSubmit
@RequiresPermissions("ma:type:add")
@SysLog(title = "机具类型管理", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增机具类型管理")
@SysLog(title = "物资类型管理", businessType = OperaType.INSERT, module = "仓储管理->新增物资类型")
@PostMapping
public AjaxResult add(@RequestBody Type type)
{
public AjaxResult add(@RequestBody Type type) {
return toAjax(typeService.insertType(type));
}
/**
* 修改机具类型管理
* 修改物资类型管理
*/
@ApiOperation(value = "修改机具类型管理")
@ApiOperation(value = "修改物资类型")
@PreventRepeatSubmit
@RequiresPermissions("ma:type:edit")
@SysLog(title = "机具类型管理", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改机具类型管理")
@SysLog(title = "物资类型管理", businessType = OperaType.UPDATE, module = "仓储管理->修改物资类型")
@PutMapping
public AjaxResult edit(@RequestBody Type type)
{
public AjaxResult edit(@RequestBody Type type) {
return toAjax(typeService.updateType(type));
}
/**
* 删除机具类型管理
* 删除物资类型管理
*/
@ApiOperation(value = "删除机具类型管理")
@ApiOperation(value = "删除物资类型")
@PreventRepeatSubmit
@RequiresPermissions("ma:type:remove")
@SysLog(title = "机具类型管理", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除机具类型管理")
@SysLog(title = "物资类型管理", businessType = OperaType.DELETE, module = "仓储管理->删除物资类型")
@DeleteMapping("/{typeIds}")
public AjaxResult remove(@PathVariable Long[] typeIds)
{
public AjaxResult remove(@PathVariable Long[] typeIds) {
return toAjax(typeService.deleteTypeByTypeIds(typeIds));
}
}

View File

@ -26,15 +26,13 @@ import com.bonus.common.core.web.page.TableDataInfo;
/**
* 库管员配置Controller
*
* @author xsheng
* @date 2024-09-27
* @author bonus
*/
@Api(tags = "库管员配置接口")
@RestController
@RequestMapping("/ma_type_keeper")
public class TypeKeeperController extends BaseController
{
public class TypeKeeperController extends BaseController {
@Autowired
private ITypeKeeperService typeKeeperService;
@ -44,8 +42,7 @@ public class TypeKeeperController extends BaseController
@ApiOperation(value = "查询库管员配置列表")
@RequiresPermissions("ma:keeper:list")
@GetMapping("/list")
public TableDataInfo list(TypeKeeper typeKeeper)
{
public TableDataInfo list(TypeKeeper typeKeeper) {
startPage();
List<TypeKeeper> list = typeKeeperService.selectTypeKeeperList(typeKeeper);
return getDataTable(list);
@ -57,10 +54,9 @@ public class TypeKeeperController extends BaseController
@ApiOperation(value = "导出库管员配置列表")
@PreventRepeatSubmit
@RequiresPermissions("ma:keeper:export")
@SysLog(title = "库管员配置", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出库管员配置")
@SysLog(title = "库管员配置", businessType = OperaType.EXPORT, module = "仓储管理->导出库管员配置")
@PostMapping("/export")
public void export(HttpServletResponse response, TypeKeeper typeKeeper)
{
public void export(HttpServletResponse response, TypeKeeper typeKeeper) {
List<TypeKeeper> list = typeKeeperService.selectTypeKeeperList(typeKeeper);
ExcelUtil<TypeKeeper> util = new ExcelUtil<TypeKeeper>(TypeKeeper.class);
util.exportExcel(response, list, "库管员配置数据");
@ -72,8 +68,7 @@ public class TypeKeeperController extends BaseController
@ApiOperation(value = "获取库管员配置详细信息")
@RequiresPermissions("ma:keeper:query")
@GetMapping(value = "/{ID}")
public AjaxResult getInfo(@PathVariable("ID") Long ID)
{
public AjaxResult getInfo(@PathVariable("ID") Long ID) {
return success(typeKeeperService.selectTypeKeeperByID(ID));
}
@ -83,10 +78,9 @@ public class TypeKeeperController extends BaseController
@ApiOperation(value = "新增库管员配置")
@PreventRepeatSubmit
@RequiresPermissions("ma:keeper:add")
@SysLog(title = "库管员配置", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增库管员配置")
@SysLog(title = "库管员配置", businessType = OperaType.INSERT, module = "仓储管理->新增库管员配置")
@PostMapping
public AjaxResult add(@RequestBody TypeKeeper typeKeeper)
{
public AjaxResult add(@RequestBody TypeKeeper typeKeeper) {
return toAjax(typeKeeperService.insertTypeKeeper(typeKeeper));
}
@ -96,10 +90,9 @@ public class TypeKeeperController extends BaseController
@ApiOperation(value = "修改库管员配置")
@PreventRepeatSubmit
@RequiresPermissions("ma:keeper:edit")
@SysLog(title = "库管员配置", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改库管员配置")
@SysLog(title = "库管员配置", businessType = OperaType.UPDATE, module = "仓储管理->修改库管员配置")
@PutMapping
public AjaxResult edit(@RequestBody TypeKeeper typeKeeper)
{
public AjaxResult edit(@RequestBody TypeKeeper typeKeeper) {
return toAjax(typeKeeperService.updateTypeKeeper(typeKeeper));
}
@ -109,7 +102,7 @@ public class TypeKeeperController extends BaseController
@ApiOperation(value = "删除库管员配置")
@PreventRepeatSubmit
@RequiresPermissions("ma:keeper:remove")
@SysLog(title = "库管员配置", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除库管员配置")
@SysLog(title = "库管员配置", businessType = OperaType.DELETE, module = "仓储管理->删除库管员配置")
@DeleteMapping("/{IDs}")
public AjaxResult remove(@PathVariable Long[] IDs)
{

View File

@ -3,24 +3,24 @@ package com.bonus.material.ma.domain;
import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import com.bonus.common.core.web.domain.BaseEntity;
/**
* 供应商管理对象 ma_supplier_info
*
* @author xsheng
* @date 2024-09-27
* 物资厂家管理对象 ma_supplier_info
* @author bonus
*/
@EqualsAndHashCode(callSuper = false)
@Data
@ToString
public class SupplierInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
public class SupplierInfo extends BaseEntity {
/** 仓库ID */
private static final long serialVersionUID = 1720446126255482527L;
/** 厂家ID */
private Long supplierId;
/** 名称 */

View File

@ -1,26 +1,28 @@
package com.bonus.material.ma.domain;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.bonus.common.core.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import com.bonus.common.core.web.domain.BaseEntity;
/**
* 机具类型管理对象 ma_type
*
* @author xsheng
* @date 2024-09-27
* 物资类型对象 ma_type
* @author syruan
*/
@EqualsAndHashCode(callSuper = false)
@Data
@ToString
public class Type extends BaseEntity
{
public class Type extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 类型ID */
@ -134,5 +136,8 @@ public class Type extends BaseEntity
@ApiModelProperty(value = "推送智慧工程定义的门类分类机具编码")
private String intelligentCode;
/** 子节点 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<Type> children = new ArrayList<>();
}

View File

@ -3,22 +3,20 @@ package com.bonus.material.ma.domain;
import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import com.bonus.common.core.web.domain.BaseEntity;
/**
* 库管员配置对象 ma_type_keeper
*
* @author xsheng
* @date 2024-09-27
*/
@EqualsAndHashCode(callSuper = false)
@Data
@ToString
public class TypeKeeper extends BaseEntity
{
private static final long serialVersionUID = 1L;
public class TypeKeeper extends BaseEntity {
private static final long serialVersionUID = -5333521595576336827L;
/** 主键ID */
private Long ID;
@ -27,10 +25,17 @@ public class TypeKeeper extends BaseEntity
private Long typeId;
/** 用户 */
@Excel(name = "用户")
@ApiModelProperty(value = "用户")
@Excel(name = "用户ID")
@ApiModelProperty(value = "用户ID")
private Long userId;
/**
* 用户名称
*/
@Excel(name = "用户名称")
@ApiModelProperty(value = "用户名称")
private String userName;
/** 数据所属组织 */
@Excel(name = "数据所属组织")
@ApiModelProperty(value = "数据所属组织")

View File

@ -5,12 +5,11 @@ import com.bonus.material.ma.domain.PartRepair;
/**
* 维修班配件配置Mapper接口
*
*
* @author xsheng
* @date 2024-09-27
*/
public interface PartRepairMapper
{
public interface PartRepairMapper {
/**
* 查询维修班配件配置
*

View File

@ -4,58 +4,55 @@ import java.util.List;
import com.bonus.material.ma.domain.SupplierInfo;
/**
* 供应商管理Mapper接口
*
* @author xsheng
* @date 2024-09-27
* 物资厂家管理Mapper接口
* @author syruan
*/
public interface SupplierInfoMapper
{
public interface SupplierInfoMapper {
/**
* 查询供应商管理
* 根据id查询物资厂家
*
* @param supplierId 供应商管理主键
* @return 供应商管理
* @param supplierId 物资厂家管理主键
* @return 物资厂家管理
*/
public SupplierInfo selectSupplierInfoBySupplierId(Long supplierId);
SupplierInfo selectSupplierInfoBySupplierId(Long supplierId);
/**
* 查询供应商管理列表
* 查询物资厂家管理列表
*
* @param supplierInfo 供应商管理
* @return 供应商管理集合
* @param supplierInfo 物资厂家管理
* @return 物资厂家管理集合
*/
public List<SupplierInfo> selectSupplierInfoList(SupplierInfo supplierInfo);
List<SupplierInfo> selectSupplierInfoList(SupplierInfo supplierInfo);
/**
* 新增供应商管理
* 新增物资厂家
*
* @param supplierInfo 供应商管理
* @param supplierInfo 物资厂家管理
* @return 结果
*/
public int insertSupplierInfo(SupplierInfo supplierInfo);
int insertSupplierInfo(SupplierInfo supplierInfo);
/**
* 修改供应商管理
* 修改物资厂家
*
* @param supplierInfo 供应商管理
* @param supplierInfo 物资厂家管理
* @return 结果
*/
public int updateSupplierInfo(SupplierInfo supplierInfo);
int updateSupplierInfo(SupplierInfo supplierInfo);
/**
* 删除供应商管理
* 删除物资厂家
*
* @param supplierId 供应商管理主键
* @param supplierId 物资厂家管理主键
* @return 结果
*/
public int deleteSupplierInfoBySupplierId(Long supplierId);
int deleteSupplierInfoBySupplierId(Long supplierId);
/**
* 批量删除供应商管理
* 批量删除物资厂家
*
* @param supplierIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteSupplierInfoBySupplierIds(Long[] supplierIds);
int deleteSupplierInfoBySupplierIds(Long[] supplierIds);
}

View File

@ -2,22 +2,20 @@ package com.bonus.material.ma.mapper;
import java.util.List;
import com.bonus.material.ma.domain.TypeKeeper;
import org.apache.ibatis.annotations.Mapper;
/**
* 库管员配置Mapper接口
*
* @author xsheng
* @date 2024-09-27
*/
public interface TypeKeeperMapper
{
@Mapper
public interface TypeKeeperMapper {
/**
* 查询库管员配置
*
* @param ID 库管员配置主键
* @return 库管员配置
*/
public TypeKeeper selectTypeKeeperByID(Long ID);
TypeKeeper selectTypeKeeperByID(Long ID);
/**
* 查询库管员配置列表
@ -25,7 +23,7 @@ public interface TypeKeeperMapper
* @param typeKeeper 库管员配置
* @return 库管员配置集合
*/
public List<TypeKeeper> selectTypeKeeperList(TypeKeeper typeKeeper);
List<TypeKeeper> selectTypeKeeperList(TypeKeeper typeKeeper);
/**
* 新增库管员配置
@ -33,7 +31,7 @@ public interface TypeKeeperMapper
* @param typeKeeper 库管员配置
* @return 结果
*/
public int insertTypeKeeper(TypeKeeper typeKeeper);
int insertTypeKeeper(TypeKeeper typeKeeper);
/**
* 修改库管员配置
@ -41,7 +39,7 @@ public interface TypeKeeperMapper
* @param typeKeeper 库管员配置
* @return 结果
*/
public int updateTypeKeeper(TypeKeeper typeKeeper);
int updateTypeKeeper(TypeKeeper typeKeeper);
/**
* 删除库管员配置
@ -49,7 +47,7 @@ public interface TypeKeeperMapper
* @param ID 库管员配置主键
* @return 结果
*/
public int deleteTypeKeeperByID(Long ID);
int deleteTypeKeeperByID(Long ID);
/**
* 批量删除库管员配置
@ -57,5 +55,5 @@ public interface TypeKeeperMapper
* @param IDs 需要删除的数据主键集合
* @return 结果
*/
public int deleteTypeKeeperByIDs(Long[] IDs);
int deleteTypeKeeperByIDs(Long[] IDs);
}

View File

@ -2,60 +2,107 @@ package com.bonus.material.ma.mapper;
import java.util.List;
import com.bonus.material.ma.domain.Type;
import com.bonus.material.ma.vo.MaTypeListVo;
import com.bonus.material.ma.vo.MaTypeSelectVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 机具类型管理Mapper接口
*
* @author xsheng
* @date 2024-09-27
* 物资类型Mapper接口
* @author syruan
*/
public interface TypeMapper
{
@Mapper
public interface TypeMapper {
/**
* 查询机具类型管理
* 查询物资类型
*
* @param typeId 机具类型管理主键
* @return 机具类型管理
* @param typeId 物资类型主键
* @return 物资类型
*/
public Type selectTypeByTypeId(Long typeId);
Type selectTypeByTypeId(Long typeId);
/**
* 查询机具类型管理列表
*
* @param type 机具类型管理
* @return 机具类型管理集合
* 根据level层级和typeID 查询父级ID
* @param typeId 物资类型主键
* @param level 类型层级
*/
public List<Type> selectTypeList(Type type);
List<Integer> selectParentId( @Param("typeId")Long typeId, @Param("level")Integer level);
/**
* 新增机具类型管理
* 根据物资仓库的ID查询物资类型列表
* @param houseId 物资仓库ID
*/
List<MaTypeSelectVo> selectMaTypeListByHouseId(Long houseId);
List<Type> getListByTypeName(@Param("typeId") Long typeId, @Param("typeName") String typeName);
/**
* 查询物资类型下拉树结构--根据上级ID
* @param parentId 父级ID
*/
List<MaTypeSelectVo> getMaTypeSelectVoListByParentId(@Param("parentId") Long parentId);
/**
* 物资类型树形结构
* @param level 排除层级
*/
List<Type> selectMaTypeTree(@Param("level") Integer level);
/**
* 查询物资类型列表
*
* @param type 机具类型管理
* @param type 物资类型
* @return 物资类型集合
*/
List<Type> selectTypeList(Type type);
/**
* 查询物资类型列表 -- 并且查询当前节点的父级节点名称
*
* @param typeListVo 物资类型
* @return 物资类型集合
*/
List<MaTypeListVo> selectTypeListAndParent(Type typeListVo);
/**
* 新增物资类型
*
* @param type 物资类型
* @return 结果
*/
public int insertType(Type type);
int insertType(Type type);
/**
* 修改机具类型管理
* 修改物资类型
*
* @param type 机具类型管理
* @param type 物资类型
* @return 结果
*/
public int updateType(Type type);
int updateType(Type type);
/**
* 删除机具类型管理
* 删除物资类型 -- 真实删除
*
* @param typeId 机具类型管理主键
* @param typeId 物资类型主键
* @return 结果
*/
public int deleteTypeByTypeId(Long typeId);
int deleteTypeByTypeId(Long typeId);
/**
* 批量删除机具类型管理
* 删除物资类型 -- 逻辑删除
*
* @param typeId 物资类型主键
* @return 结果
*/
int logicDeleteTypeByTypeId(Long typeId);
/**
* 批量删除物资类型 -- 逻辑删除
*
* @param typeIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteTypeByTypeIds(Long[] typeIds);
int logicDeleteTypeByTypeIds(Long[] typeIds);
}

View File

@ -4,58 +4,56 @@ import java.util.List;
import com.bonus.material.ma.domain.SupplierInfo;
/**
* 供应商管理Service接口
* 物资厂家管理Service接口
*
* @author xsheng
* @date 2024-09-27
* @author bonus
*/
public interface ISupplierInfoService
{
public interface ISupplierInfoService {
/**
* 查询供应商管理
* 查询物资厂家管理
*
* @param supplierId 供应商管理主键
* @return 供应商管理
* @param supplierId 物资厂家管理主键
* @return 物资厂家管理
*/
public SupplierInfo selectSupplierInfoBySupplierId(Long supplierId);
SupplierInfo selectSupplierInfoBySupplierId(Long supplierId);
/**
* 查询供应商管理列表
* 查询物资厂家管理列表
*
* @param supplierInfo 供应商管理
* @return 供应商管理集合
* @param supplierInfo 物资厂家管理
* @return 物资厂家管理集合
*/
public List<SupplierInfo> selectSupplierInfoList(SupplierInfo supplierInfo);
List<SupplierInfo> selectSupplierInfoList(SupplierInfo supplierInfo);
/**
* 新增供应商管理
* 新增物资厂家管理
*
* @param supplierInfo 供应商管理
* @param supplierInfo 物资厂家管理
* @return 结果
*/
public int insertSupplierInfo(SupplierInfo supplierInfo);
int insertSupplierInfo(SupplierInfo supplierInfo);
/**
* 修改供应商管理
* 修改物资厂家管理
*
* @param supplierInfo 供应商管理
* @param supplierInfo 物资厂家管理
* @return 结果
*/
public int updateSupplierInfo(SupplierInfo supplierInfo);
int updateSupplierInfo(SupplierInfo supplierInfo);
/**
* 批量删除供应商管理
* 批量删除物资厂家管理
*
* @param supplierIds 需要删除的供应商管理主键集合
* @param supplierIds 需要删除的物资厂家管理主键集合
* @return 结果
*/
public int deleteSupplierInfoBySupplierIds(Long[] supplierIds);
int deleteSupplierInfoBySupplierIds(Long[] supplierIds);
/**
* 删除供应商管理信息
* 删除物资厂家管理信息
*
* @param supplierId 供应商管理主键
* @param supplierId 物资厂家管理主键
* @return 结果
*/
public int deleteSupplierInfoBySupplierId(Long supplierId);
int deleteSupplierInfoBySupplierId(Long supplierId);
}

View File

@ -5,19 +5,15 @@ import com.bonus.material.ma.domain.TypeKeeper;
/**
* 库管员配置Service接口
*
* @author xsheng
* @date 2024-09-27
*/
public interface ITypeKeeperService
{
public interface ITypeKeeperService {
/**
* 查询库管员配置
*
* @param ID 库管员配置主键
* @return 库管员配置
*/
public TypeKeeper selectTypeKeeperByID(Long ID);
TypeKeeper selectTypeKeeperByID(Long ID);
/**
* 查询库管员配置列表
@ -25,7 +21,7 @@ public interface ITypeKeeperService
* @param typeKeeper 库管员配置
* @return 库管员配置集合
*/
public List<TypeKeeper> selectTypeKeeperList(TypeKeeper typeKeeper);
List<TypeKeeper> selectTypeKeeperList(TypeKeeper typeKeeper);
/**
* 新增库管员配置
@ -33,7 +29,7 @@ public interface ITypeKeeperService
* @param typeKeeper 库管员配置
* @return 结果
*/
public int insertTypeKeeper(TypeKeeper typeKeeper);
int insertTypeKeeper(TypeKeeper typeKeeper);
/**
* 修改库管员配置
@ -41,7 +37,7 @@ public interface ITypeKeeperService
* @param typeKeeper 库管员配置
* @return 结果
*/
public int updateTypeKeeper(TypeKeeper typeKeeper);
int updateTypeKeeper(TypeKeeper typeKeeper);
/**
* 批量删除库管员配置
@ -49,7 +45,7 @@ public interface ITypeKeeperService
* @param IDs 需要删除的库管员配置主键集合
* @return 结果
*/
public int deleteTypeKeeperByIDs(Long[] IDs);
int deleteTypeKeeperByIDs(Long[] IDs);
/**
* 删除库管员配置信息
@ -57,5 +53,5 @@ public interface ITypeKeeperService
* @param ID 库管员配置主键
* @return 结果
*/
public int deleteTypeKeeperByID(Long ID);
int deleteTypeKeeperByID(Long ID);
}

View File

@ -1,61 +1,86 @@
package com.bonus.material.ma.service;
import java.util.List;
import com.bonus.common.biz.domain.TreeSelect;
import com.bonus.material.ma.domain.Type;
import com.bonus.material.ma.vo.MaTypeListVo;
import com.bonus.material.ma.vo.MaTypeSelectVo;
/**
* 机具类型管理Service接口
*
* @author xsheng
* @date 2024-09-27
* 物资类型Service接口
* @author syruan
*/
public interface ITypeService
{
public interface ITypeService {
/**
* 查询机具类型管理
* 查询物资类型
*
* @param typeId 机具类型管理主键
* @return 机具类型管理
* @param typeId 物资类型主键
* @return 物资类型
*/
public Type selectTypeByTypeId(Long typeId);
Type selectTypeByTypeId(Long typeId);
List<Integer> selectParentId(Long typeId, Integer level);
List<MaTypeSelectVo> selectMaTypeListByHouseId(Long houseId);
List<Type> getListByParentId(Long typeId, String typeName);
/**
* 查询机具类型管理列表
*
* @param type 机具类型管理
* @return 机具类型管理集合
* 查询物资类型下拉树结构--根据上级ID
* @param parentId 父级id
*/
public List<Type> selectTypeList(Type type);
List<MaTypeSelectVo> getMaTypeSelectVoListByParentId(Long parentId);
/**
* 新增机具类型管理
* 查询物资类型列表
*
* @param type 机具类型管理
* @param type 物资类型
* @return 物资类型集合
*/
List<Type> selectTypeList(Type type);
List<MaTypeListVo> selectTypeListAndParent(Type type);
/**
* 新增物资类型
*
* @param type 物资类型
* @return 结果
*/
public int insertType(Type type);
int insertType(Type type);
/**
* 修改机具类型管理
* 修改物资类型
*
* @param type 机具类型管理
* @param type 物资类型
* @return 结果
*/
public int updateType(Type type);
int updateType(Type type);
/**
* 批量删除机具类型管理
* 批量删除物资类型
*
* @param typeIds 需要删除的机具类型管理主键集合
* @param typeIds 需要删除的物资类型主键集合
* @return 结果
*/
public int deleteTypeByTypeIds(Long[] typeIds);
int deleteTypeByTypeIds(Long[] typeIds);
/**
* 删除机具类型管理信息
* 删除物资类型信息
*
* @param typeId 机具类型管理主键
* @param typeId 物资类型主键
* @return 结果
*/
public int deleteTypeByTypeId(Long typeId);
int deleteTypeByTypeId(Long typeId);
List<TreeSelect> getMaTypeTree(String typeName, String parentId);
/**
* 构建前端所需要树结构
*
* @param maTypeList 状态列表
* @return 树结构列表
*/
List<Type> buildMaTypeTree(List<Type> maTypeList);
}

View File

@ -8,89 +8,83 @@ import com.bonus.material.ma.mapper.SupplierInfoMapper;
import com.bonus.material.ma.domain.SupplierInfo;
import com.bonus.material.ma.service.ISupplierInfoService;
import javax.annotation.Resource;
/**
* 供应商管理Service业务层处理
* 物资厂家管理Service业务层处理
*
* @author xsheng
* @date 2024-09-27
* @author bonus
*/
@Service
public class SupplierInfoServiceImpl implements ISupplierInfoService
{
@Autowired
public class SupplierInfoServiceImpl implements ISupplierInfoService {
@Resource
private SupplierInfoMapper supplierInfoMapper;
/**
* 查询供应商管理
* 查询物资厂家管理
*
* @param supplierId 供应商管理主键
* @return 供应商管理
* @param supplierId 物资厂家管理主键
* @return 物资厂家管理
*/
@Override
public SupplierInfo selectSupplierInfoBySupplierId(Long supplierId)
{
public SupplierInfo selectSupplierInfoBySupplierId(Long supplierId) {
return supplierInfoMapper.selectSupplierInfoBySupplierId(supplierId);
}
/**
* 查询供应商管理列表
* 查询物资厂家管理列表
*
* @param supplierInfo 供应商管理
* @return 供应商管理
* @param supplierInfo 物资厂家管理
* @return 物资厂家管理
*/
@Override
public List<SupplierInfo> selectSupplierInfoList(SupplierInfo supplierInfo)
{
public List<SupplierInfo> selectSupplierInfoList(SupplierInfo supplierInfo) {
return supplierInfoMapper.selectSupplierInfoList(supplierInfo);
}
/**
* 新增供应商管理
* 新增物资厂家管理
*
* @param supplierInfo 供应商管理
* @param supplierInfo 物资厂家管理
* @return 结果
*/
@Override
public int insertSupplierInfo(SupplierInfo supplierInfo)
{
public int insertSupplierInfo(SupplierInfo supplierInfo) {
supplierInfo.setCreateTime(DateUtils.getNowDate());
return supplierInfoMapper.insertSupplierInfo(supplierInfo);
}
/**
* 修改供应商管理
* 修改物资厂家管理
*
* @param supplierInfo 供应商管理
* @param supplierInfo 物资厂家管理
* @return 结果
*/
@Override
public int updateSupplierInfo(SupplierInfo supplierInfo)
{
public int updateSupplierInfo(SupplierInfo supplierInfo) {
supplierInfo.setUpdateTime(DateUtils.getNowDate());
return supplierInfoMapper.updateSupplierInfo(supplierInfo);
}
/**
* 批量删除供应商管理
* 批量删除物资厂家管理
*
* @param supplierIds 需要删除的供应商管理主键
* @param supplierIds 需要删除的物资厂家管理主键
* @return 结果
*/
@Override
public int deleteSupplierInfoBySupplierIds(Long[] supplierIds)
{
public int deleteSupplierInfoBySupplierIds(Long[] supplierIds) {
return supplierInfoMapper.deleteSupplierInfoBySupplierIds(supplierIds);
}
/**
* 删除供应商管理信息
* 删除物资厂家管理信息
*
* @param supplierId 供应商管理主键
* @param supplierId 物资厂家管理主键
* @return 结果
*/
@Override
public int deleteSupplierInfoBySupplierId(Long supplierId)
{
public int deleteSupplierInfoBySupplierId(Long supplierId) {
return supplierInfoMapper.deleteSupplierInfoBySupplierId(supplierId);
}
}

View File

@ -15,8 +15,8 @@ import com.bonus.material.ma.service.ITypeKeeperService;
* @date 2024-09-27
*/
@Service
public class TypeKeeperServiceImpl implements ITypeKeeperService
{
public class TypeKeeperServiceImpl implements ITypeKeeperService {
@Autowired
private TypeKeeperMapper typeKeeperMapper;
@ -27,8 +27,7 @@ public class TypeKeeperServiceImpl implements ITypeKeeperService
* @return 库管员配置
*/
@Override
public TypeKeeper selectTypeKeeperByID(Long ID)
{
public TypeKeeper selectTypeKeeperByID(Long ID) {
return typeKeeperMapper.selectTypeKeeperByID(ID);
}
@ -39,8 +38,7 @@ public class TypeKeeperServiceImpl implements ITypeKeeperService
* @return 库管员配置
*/
@Override
public List<TypeKeeper> selectTypeKeeperList(TypeKeeper typeKeeper)
{
public List<TypeKeeper> selectTypeKeeperList(TypeKeeper typeKeeper) {
return typeKeeperMapper.selectTypeKeeperList(typeKeeper);
}
@ -51,8 +49,7 @@ public class TypeKeeperServiceImpl implements ITypeKeeperService
* @return 结果
*/
@Override
public int insertTypeKeeper(TypeKeeper typeKeeper)
{
public int insertTypeKeeper(TypeKeeper typeKeeper) {
typeKeeper.setCreateTime(DateUtils.getNowDate());
return typeKeeperMapper.insertTypeKeeper(typeKeeper);
}
@ -64,8 +61,7 @@ public class TypeKeeperServiceImpl implements ITypeKeeperService
* @return 结果
*/
@Override
public int updateTypeKeeper(TypeKeeper typeKeeper)
{
public int updateTypeKeeper(TypeKeeper typeKeeper) {
typeKeeper.setUpdateTime(DateUtils.getNowDate());
return typeKeeperMapper.updateTypeKeeper(typeKeeper);
}
@ -77,8 +73,7 @@ public class TypeKeeperServiceImpl implements ITypeKeeperService
* @return 结果
*/
@Override
public int deleteTypeKeeperByIDs(Long[] IDs)
{
public int deleteTypeKeeperByIDs(Long[] IDs) {
return typeKeeperMapper.deleteTypeKeeperByIDs(IDs);
}

View File

@ -1,96 +1,291 @@
package com.bonus.material.ma.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import com.bonus.common.biz.domain.TreeSelect;
import com.bonus.common.biz.enums.DataCodeEnum;
import com.bonus.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import com.bonus.common.core.utils.StringUtils;
import com.bonus.material.ma.vo.MaTypeListVo;
import com.bonus.material.ma.vo.MaTypeSelectVo;
import org.springframework.stereotype.Service;
import com.bonus.material.ma.mapper.TypeMapper;
import com.bonus.material.ma.domain.Type;
import com.bonus.material.ma.service.ITypeService;
import javax.annotation.Resource;
/**
* 机具类型管理Service业务层处理
*
* @author xsheng
* @date 2024-09-27
* 物资类型管理Service业务层实现
* @author syruan
*/
@Service
public class TypeServiceImpl implements ITypeService
{
@Autowired
public class TypeServiceImpl implements ITypeService {
/**
* 物资类型管理树最小级别
*/
public static final Integer TYPE_MIN_LEVEL = 4;
@Resource
private TypeMapper typeMapper;
/**
* 查询机具类型管理
* 查询物资类型 -- 根据id
*
* @param typeId 机具类型管理主键
* @return 机具类型管理
* @param typeId 物资类型管理主键
*/
@Override
public Type selectTypeByTypeId(Long typeId)
{
public Type selectTypeByTypeId(Long typeId) {
return typeMapper.selectTypeByTypeId(typeId);
}
@Override
public List<Integer> selectParentId(Long typeId, Integer level) {
return typeMapper.selectParentId(typeId, level);
}
@Override
public List<MaTypeSelectVo> selectMaTypeListByHouseId(Long houseId) {
return typeMapper.selectMaTypeListByHouseId(houseId);
}
/**
* 查询机具类型管理列表
*
* @param type 机具类型管理
* @return 机具类型管理
* 根据组织树parent_id查询结果
*
* @param typeId 父级id
* @param typeName 名称筛选
*/
@Override
public List<Type> selectTypeList(Type type)
{
public List<Type> getListByParentId(Long typeId, String typeName) {
return typeMapper.getListByTypeName(typeId, typeName);
}
@Override
public List<MaTypeSelectVo> getMaTypeSelectVoListByParentId(Long parentId) {
return typeMapper.getMaTypeSelectVoListByParentId(parentId);
}
/**
* 查询物资类型管理列表
*
* @param type 物资类型管理
* @return 物资类型管理
*/
@Override
public List<Type> selectTypeList(Type type) {
if (type != null ) {
if (type.getDelFlag() == null || type.getDelFlag().isEmpty()) {
// 如果没赋值则默认查询正常数据状态
type.setDelFlag(String.valueOf(DataCodeEnum.NORMAL.getCode()));
}
// 如果是顶级节点则查询所有子节点
if ("0".equals(type.getLevel())) {
type.setLevel(null);
}
}
return typeMapper.selectTypeList(type);
}
/**
* 新增机具类型管理
* 查询物资类型管理列表 -- 并获取父级信息
*
* @param type 物资类型管理
* @return 物资类型管理
*/
@Override
public List<MaTypeListVo> selectTypeListAndParent(Type type) {
// 如果是顶级节点则查询所有子节点
if (type != null && type.getLevel() != null && "0".equals(type.getLevel())) {
type.setLevel(null);
}
// 拿到数据要处理一下上级信息
List<MaTypeListVo> maTypeListVos;
try {
maTypeListVos = typeMapper.selectTypeListAndParent(type);
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
// 检查Mapper集合
if (maTypeListVos == null || maTypeListVos.isEmpty()) {
return new ArrayList<>();
}
for (MaTypeListVo maTypeListVo : maTypeListVos) {
// ------------ 检查 -----------
// object对象是空的忽略处理
if (maTypeListVo == null) {
continue;
}
// 没有上级就不需要处理或者level等级不清晰的也不进行处理
if (maTypeListVo.getParentId() == null || maTypeListVo.getLevel() == null) {
continue;
}
// 1级节点已经是顶级无上级所以不需要处理
if ("1".equals(maTypeListVo.getLevel())) {
continue;
}
// ------------ 检查结束 -----------
// 进行数据处理
switch (maTypeListVo.getLevel()) {
case "2":
// 二级节点父级是一级节点所以要拿到父节点名称并赋值至ONE_LEVEL_NAME字段
maTypeListVo.setParentOneLevelName(maTypeListVo.getParentThreeLevelName() == null ? "" : maTypeListVo.getParentThreeLevelName());
break;
case "3":
// 三级节点父级是二级节点和一级节点 要把祖父类型名称放入一级字段把父类型名称存入二级字段
maTypeListVo.setParentOneLevelName(maTypeListVo.getParentTwoLevelName() == null ? "" : maTypeListVo.getParentTwoLevelName());
maTypeListVo.setParentTwoLevelName(maTypeListVo.getParentThreeLevelName() == null ? "" : maTypeListVo.getParentThreeLevelName());
break;
case "4":
// 四级节点父级是三级节点和二级节点和一级节点 要把祖父类型名称放入一级字段把父类型名称存入二级字段子类型名称存入三级字段
// 但因为4级节点内循环3次已按顺序处理所以此处无需处理
break;
}
}
return maTypeListVos;
}
/**
* 新增物资类型管理
*
* @param type 机具类型管理
* @param type 物资类型管理
* @return 结果
*/
@Override
public int insertType(Type type)
{
public int insertType(Type type) {
type.setCreateTime(DateUtils.getNowDate());
return typeMapper.insertType(type);
}
/**
* 修改机具类型管理
* 修改物资类型管理
*
* @param type 机具类型管理
* @param type 物资类型管理
* @return 结果
*/
@Override
public int updateType(Type type)
{
public int updateType(Type type) {
type.setUpdateTime(DateUtils.getNowDate());
return typeMapper.updateType(type);
}
/**
* 批量删除机具类型管理
* 批量删除物资类型管理
*
* @param typeIds 需要删除的机具类型管理主键
* @param typeIds 需要删除的物资类型管理主键
* @return 结果
*/
@Override
public int deleteTypeByTypeIds(Long[] typeIds)
{
return typeMapper.deleteTypeByTypeIds(typeIds);
public int deleteTypeByTypeIds(Long[] typeIds) {
return typeMapper.logicDeleteTypeByTypeIds(typeIds);
}
/**
* 删除机具类型管理信息
* 删除物资类型
*
* @param typeId 机具类型管理主键
* @param typeId 物资类型管理主键
* @return 结果
*/
@Override
public int deleteTypeByTypeId(Long typeId)
{
return typeMapper.deleteTypeByTypeId(typeId);
public int deleteTypeByTypeId(Long typeId) {
return typeMapper.logicDeleteTypeByTypeId(typeId);
}
@Override
public List<TreeSelect> getMaTypeTree(String typeName, String parentId) {
List<Type> maTypes = typeMapper.selectMaTypeTree(TYPE_MIN_LEVEL);
List<Type> builtMaTypeList = buildMaTypeTree(maTypes);
List<TreeSelect> treeSelectList = builtMaTypeList.stream()
.filter(Objects::nonNull)
.map(this::convertToTreeSelect)
.collect(Collectors.toList());
// 查询顶级节点的仓库配置信息
// 如果没有查询到那么返回空
return treeSelectList;
}
/**
* 通过构造函数将 Type对象 转换为 TreeSelect -- 并递归处理子节点
* @param type 要进行转换的object对象
*/
private TreeSelect convertToTreeSelect(Type type) {
List<TreeSelect> children = type.getChildren().stream()
.filter(Objects::nonNull)
.map(this::convertToTreeSelect)
.collect(Collectors.toList());
return new TreeSelect(type.getTypeId(), type.getTypeName(),Integer.valueOf(type.getLevel()),type.getParentId(), children);
}
/**
* 构建前端所需要树结构
*
* @param maTypeList 部门列表
* @return 树结构列表
*/
@Override
public List<Type> buildMaTypeTree(List<Type> maTypeList) {
List<Type> returnList = new ArrayList<Type>();
List<Long> tempList = maTypeList.stream().map(Type::getTypeId).collect(Collectors.toList());
for (Type maType : maTypeList) {
// 如果是顶级节点, 遍历该父节点的所有子节点
if (!tempList.contains(maType.getParentId())) {
recursionFn(maTypeList, maType);
returnList.add(maType);
}
}
if (returnList.isEmpty()) {
returnList = maTypeList;
}
return returnList;
}
/**
* 递归列表
*/
private void recursionFn(List<Type> list, Type t) {
// 得到子节点列表
List<Type> childList = getChildList(list, t);
t.setChildren(childList);
for (Type tChild : childList) {
if (hasChild(list, tChild)) {
recursionFn(list, tChild);
}
}
}
/**
* 得到子节点列表
*/
private List<Type> getChildList(List<Type> list, Type t) {
List<Type> tlist = new ArrayList<>();
for (Type n : list) {
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getTypeId().longValue()) {
tlist.add(n);
}
}
return tlist;
}
/**
* 判断是否有子节点
*/
private boolean hasChild(List<Type> list, Type t) {
return !getChildList(list, t).isEmpty();
}
}

View File

@ -0,0 +1,26 @@
package com.bonus.material.ma.vo;
import com.bonus.material.ma.domain.Type;
import lombok.Getter;
import lombok.Setter;
/**
* @author : 阮世耀
* @version : 1.0
* @PackagePath: com.bonus.material.ma.vo
* @CreateTime: 2024-10-14 17:47
* @Description: 物资类型列表展示VO
*/
@Getter
@Setter
public class MaTypeListVo extends Type {
private String parentOneLevelName;
private String parentTwoLevelName;
private String parentThreeLevelName;
private String parentFourLevelName;
}

View File

@ -0,0 +1,23 @@
package com.bonus.material.ma.vo;
import lombok.Data;
/**
* @author : 阮世耀
* @version : 1.0
* @PackagePath: com.bonus.material.ma.vo
* @CreateTime: 2024-10-15 15:39
* @Description: 物资类型下拉框
*/
@Data
public class MaTypeSelectVo {
private Long typeId;
private String typeName;
private String parentId;
private Integer level;
}

View File

@ -33,8 +33,8 @@ import com.bonus.common.core.web.page.TableDataInfo;
@Api(tags = "仓库管理接口")
@RestController
@RequestMapping("/wh_house_info")
public class WhHouseInfoController extends BaseController
{
public class WhHouseInfoController extends BaseController {
@Autowired
private IWhHouseInfoService whHouseInfoService;
@ -44,23 +44,32 @@ public class WhHouseInfoController extends BaseController
@ApiOperation(value = "查询仓库管理列表")
@RequiresPermissions("warehouse:info:list")
@GetMapping("/list")
public TableDataInfo list(WhHouseInfo whHouseInfo)
{
public TableDataInfo list(WhHouseInfo whHouseInfo) {
startPage();
List<WhHouseInfo> list = whHouseInfoService.selectWhHouseInfoList(whHouseInfo);
return getDataTable(list);
}
/**
* 查询仓库列表 -- 不分页
*/
@ApiOperation(value = "查询仓库列表--不分页")
@RequiresPermissions("warehouse:info:list")
@GetMapping("/listNoPage")
public AjaxResult listNoPage(WhHouseInfo whHouseInfo) {
List<WhHouseInfo> list = whHouseInfoService.selectWhHouseInfoList(whHouseInfo);
return success(list);
}
/**
* 导出仓库管理列表
*/
@ApiOperation(value = "导出仓库管理列表")
@PreventRepeatSubmit
@RequiresPermissions("warehouse:info:export")
@SysLog(title = "仓库管理", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出仓库管理")
@SysLog(title = "仓库管理", businessType = OperaType.EXPORT, module = "仓储管理->导出仓库管理")
@PostMapping("/export")
public void export(HttpServletResponse response, WhHouseInfo whHouseInfo)
{
public void export(HttpServletResponse response, WhHouseInfo whHouseInfo) {
List<WhHouseInfo> list = whHouseInfoService.selectWhHouseInfoList(whHouseInfo);
ExcelUtil<WhHouseInfo> util = new ExcelUtil<WhHouseInfo>(WhHouseInfo.class);
util.exportExcel(response, list, "仓库管理数据");
@ -72,8 +81,7 @@ public class WhHouseInfoController extends BaseController
@ApiOperation(value = "获取仓库管理详细信息")
@RequiresPermissions("warehouse:info:query")
@GetMapping(value = "/{houseId}")
public AjaxResult getInfo(@PathVariable("houseId") Long houseId)
{
public AjaxResult getInfo(@PathVariable("houseId") Long houseId) {
return success(whHouseInfoService.selectWhHouseInfoByHouseId(houseId));
}
@ -85,8 +93,7 @@ public class WhHouseInfoController extends BaseController
@RequiresPermissions("warehouse:info:add")
@SysLog(title = "仓库管理", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增仓库管理")
@PostMapping
public AjaxResult add(@RequestBody WhHouseInfo whHouseInfo)
{
public AjaxResult add(@RequestBody WhHouseInfo whHouseInfo) {
return toAjax(whHouseInfoService.insertWhHouseInfo(whHouseInfo));
}
@ -98,8 +105,7 @@ public class WhHouseInfoController extends BaseController
@RequiresPermissions("warehouse:info:edit")
@SysLog(title = "仓库管理", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改仓库管理")
@PutMapping
public AjaxResult edit(@RequestBody WhHouseInfo whHouseInfo)
{
public AjaxResult edit(@RequestBody WhHouseInfo whHouseInfo) {
return toAjax(whHouseInfoService.updateWhHouseInfo(whHouseInfo));
}
@ -109,10 +115,9 @@ public class WhHouseInfoController extends BaseController
@ApiOperation(value = "删除仓库管理")
@PreventRepeatSubmit
@RequiresPermissions("warehouse:info:remove")
@SysLog(title = "仓库管理", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除仓库管理")
@SysLog(title = "仓库管理", businessType = OperaType.DELETE, module = "仓储管理->删除仓库管理")
@DeleteMapping("/{houseIds}")
public AjaxResult remove(@PathVariable Long[] houseIds)
{
public AjaxResult remove(@PathVariable Long[] houseIds) {
return toAjax(whHouseInfoService.deleteWhHouseInfoByHouseIds(houseIds));
}
}

View File

@ -33,8 +33,8 @@ import com.bonus.common.core.web.page.TableDataInfo;
@Api(tags = "仓库货架配置接口")
@RestController
@RequestMapping("/wh_house_set")
public class WhHouseSetController extends BaseController
{
public class WhHouseSetController extends BaseController {
@Autowired
private IWhHouseSetService whHouseSetService;

View File

@ -3,22 +3,20 @@ package com.bonus.material.warehouse.domain;
import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import com.bonus.common.core.web.domain.BaseEntity;
/**
* 仓库管理对象 wh_house_info
*
* @author xsheng
* @date 2024-09-27
* @author bonus
*/
@EqualsAndHashCode(callSuper = false)
@Data
@ToString
public class WhHouseInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
public class WhHouseInfo extends BaseEntity {
private static final long serialVersionUID = -6993602646196064834L;
/** 仓库ID */
private Long houseId;
@ -28,6 +26,16 @@ public class WhHouseInfo extends BaseEntity
@ApiModelProperty(value = "工程项目名称")
private String houseName;
/** 实物库名称 */
@Excel(name = "实物库名称")
@ApiModelProperty(value = "实物库名称")
private String physicalName;
/** 仓库地理位置 */
@Excel(name = "仓库地理位置")
@ApiModelProperty(value = "仓库地址位置")
private String geoLocation;
/** 上级ID */
@Excel(name = "上级ID")
@ApiModelProperty(value = "上级ID")
@ -43,11 +51,12 @@ public class WhHouseInfo extends BaseEntity
private Long deptId;
/** 删除标志0代表存在 2代表删除 */
@ApiModelProperty(value = "删除标志0存在 2代表已删除")
private String delFlag;
/** 数据所属组织 */
@Excel(name = "数据所属组织")
@ApiModelProperty(value = "数据所属组织")
@Excel(name = "所属组织")
@ApiModelProperty(value = "所属组织")
private String companyId;
/** 排序 */

View File

@ -1,11 +1,15 @@
package com.bonus.material.warehouse.domain;
import com.bonus.common.biz.domain.TreeSelect;
import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import com.bonus.common.core.web.domain.BaseEntity;
import java.util.ArrayList;
import java.util.List;
/**
* 仓库货架配置对象 wh_house_set
*
@ -16,8 +20,8 @@ import com.bonus.common.core.web.domain.BaseEntity;
@Data
@ToString
public class WhHouseSet extends BaseEntity
{
public class WhHouseSet extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 主键id */
@ -28,6 +32,10 @@ public class WhHouseSet extends BaseEntity
@ApiModelProperty(value = "仓库ID")
private Long houseId;
@Excel(name = "仓库名称")
@ApiModelProperty(value = "仓库名称")
private String houseName;
/** 机具类型ID */
@Excel(name = "机具类型ID")
@ApiModelProperty(value = "机具类型ID")
@ -65,5 +73,9 @@ public class WhHouseSet extends BaseEntity
@ApiModelProperty(value = "货架编号")
private String shelfNum;
/**
* 仓库下物资树
*/
private List<TreeSelect> treeSelectList = new ArrayList<>();
}

View File

@ -25,7 +25,7 @@ public interface WhHouseInfoMapper
* @param whHouseInfo 仓库管理
* @return 仓库管理集合
*/
public List<WhHouseInfo> selectWhHouseInfoList(WhHouseInfo whHouseInfo);
List<WhHouseInfo> selectWhHouseInfoList(WhHouseInfo whHouseInfo);
/**
* 新增仓库管理

View File

@ -25,7 +25,14 @@ public interface WhHouseSetMapper
* @param whHouseSet 仓库货架配置
* @return 仓库货架配置集合
*/
public List<WhHouseSet> selectWhHouseSetList(WhHouseSet whHouseSet);
List<WhHouseSet> selectWhHouseSetList(WhHouseSet whHouseSet);
/**
* 根据物资类型id查询机具列表
* @param typeId 物资类型id
*/
List<WhHouseSet> selectListByMaType(Long typeId);
/**
* 新增仓库货架配置

View File

@ -9,15 +9,14 @@ import com.bonus.material.warehouse.domain.WhHouseInfo;
* @author xsheng
* @date 2024-09-27
*/
public interface IWhHouseInfoService
{
public interface IWhHouseInfoService {
/**
* 查询仓库管理
*
* @param houseId 仓库管理主键
* @return 仓库管理
*/
public WhHouseInfo selectWhHouseInfoByHouseId(Long houseId);
WhHouseInfo selectWhHouseInfoByHouseId(Long houseId);
/**
* 查询仓库管理列表
@ -25,7 +24,7 @@ public interface IWhHouseInfoService
* @param whHouseInfo 仓库管理
* @return 仓库管理集合
*/
public List<WhHouseInfo> selectWhHouseInfoList(WhHouseInfo whHouseInfo);
List<WhHouseInfo> selectWhHouseInfoList(WhHouseInfo whHouseInfo);
/**
* 新增仓库管理
@ -33,7 +32,7 @@ public interface IWhHouseInfoService
* @param whHouseInfo 仓库管理
* @return 结果
*/
public int insertWhHouseInfo(WhHouseInfo whHouseInfo);
int insertWhHouseInfo(WhHouseInfo whHouseInfo);
/**
* 修改仓库管理
@ -41,7 +40,7 @@ public interface IWhHouseInfoService
* @param whHouseInfo 仓库管理
* @return 结果
*/
public int updateWhHouseInfo(WhHouseInfo whHouseInfo);
int updateWhHouseInfo(WhHouseInfo whHouseInfo);
/**
* 批量删除仓库管理
@ -49,7 +48,7 @@ public interface IWhHouseInfoService
* @param houseIds 需要删除的仓库管理主键集合
* @return 结果
*/
public int deleteWhHouseInfoByHouseIds(Long[] houseIds);
int deleteWhHouseInfoByHouseIds(Long[] houseIds);
/**
* 删除仓库管理信息
@ -57,5 +56,5 @@ public interface IWhHouseInfoService
* @param houseId 仓库管理主键
* @return 结果
*/
public int deleteWhHouseInfoByHouseId(Long houseId);
int deleteWhHouseInfoByHouseId(Long houseId);
}

View File

@ -27,6 +27,8 @@ public interface IWhHouseSetService
*/
public List<WhHouseSet> selectWhHouseSetList(WhHouseSet whHouseSet);
List<WhHouseSet> selectListByMaType(Long typeId);
/**
* 新增仓库货架配置
*

View File

@ -39,8 +39,7 @@ public class WhHouseInfoServiceImpl implements IWhHouseInfoService
* @return 仓库管理
*/
@Override
public List<WhHouseInfo> selectWhHouseInfoList(WhHouseInfo whHouseInfo)
{
public List<WhHouseInfo> selectWhHouseInfoList(WhHouseInfo whHouseInfo) {
return whHouseInfoMapper.selectWhHouseInfoList(whHouseInfo);
}

View File

@ -44,6 +44,14 @@ public class WhHouseSetServiceImpl implements IWhHouseSetService
return whHouseSetMapper.selectWhHouseSetList(whHouseSet);
}
@Override
public List<WhHouseSet> selectListByMaType(Long typeId) {
return whHouseSetMapper.selectListByMaType(typeId);
}
;
/**
* 新增仓库货架配置
*

View File

@ -9,12 +9,10 @@ spring:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
# namespace: sgzb_bns
namespace: sgzb_bns
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
# namespace: sgzb_bns
namespace: sgzb_bns
# 配置文件格式
file-extension: yml

View File

@ -38,6 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="businessLicense != null and businessLicense != ''"> and business_license = #{businessLicense}</if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId}</if>
<if test="status != null "> and status = #{status}</if>
and del_flag = '0'
</where>
</select>
@ -59,8 +60,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="delFlag != null">del_flag,</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="remark != null">remark,</if>
<if test="companyId != null">company_id,</if>
<if test="status != null">status,</if>
@ -76,8 +75,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="delFlag != null">#{delFlag},</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="remark != null">#{remark},</if>
<if test="companyId != null">#{companyId},</if>
<if test="status != null">#{status},</if>
@ -94,9 +91,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="phone != null">phone = #{phone},</if>
<if test="businessScope != null">business_scope = #{businessScope},</if>
<if test="businessLicense != null">business_license = #{businessLicense},</if>
<if test="delFlag != null">del_flag = #{delFlag},</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="remark != null">remark = #{remark},</if>
@ -107,11 +101,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteSupplierInfoBySupplierId" parameterType="Long">
delete from ma_supplier_info where supplier_id = #{supplierId}
update ma_supplier_info set del_flag = 2 where supplier_id = #{supplierId}
</delete>
<delete id="deleteSupplierInfoBySupplierIds" parameterType="String">
delete from ma_supplier_info where supplier_id in
update ma_supplier_info set del_flag = 2 where supplier_id in
<foreach item="supplierId" collection="array" open="(" separator="," close=")">
#{supplierId}
</foreach>

View File

@ -52,8 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=",">
<if test="typeId != null">type_id = #{typeId},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
update_time = #{updateTime},
<if test="companyId != null">company_id = #{companyId},</if>
</trim>
where ID = #{ID}

View File

@ -3,6 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.material.ma.mapper.TypeMapper">
<resultMap type="com.bonus.material.ma.domain.Type" id="TypeResult">
<result property="typeId" column="type_id" />
<result property="typeName" column="type_name" />
@ -34,15 +35,54 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="intelligentCode" column="intelligent_code" />
</resultMap>
<resultMap type="com.bonus.material.ma.vo.MaTypeListVo" id="MaTypeListVoResult">
<result property="typeId" column="type_id" />
<result property="typeName" column="type_name" />
<result property="parentId" column="parent_id" />
<result property="storageNum" column="storage_num" />
<result property="typeCode" column="type_code" />
<result property="modelCode" column="model_code" />
<result property="unitId" column="unit_id" />
<result property="manageType" column="manage_type" />
<result property="leasePrice" column="lease_price" />
<result property="effTime" column="eff_time" />
<result property="rentPrice" column="rent_price" />
<result property="buyPrice" column="buy_price" />
<result property="payRatio" column="pay_ratio" />
<result property="level" column="level" />
<result property="ratedLoad" column="rated_load" />
<result property="testLoad" column="test_load" />
<result property="holdingTime" column="holding_time" />
<result property="warnNum" column="warn_num" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="isPlan" column="is_plan" />
<result property="isAncuo" column="is_ancuo" />
<result property="remark" column="remark" />
<result property="facModel" column="fac_model" />
<result property="intelligentCode" column="intelligent_code" />
<result property="parentOneLevelName" column="parentFourLevelName" />
<result property="parentTwoLevelName" column="parentThreeLevelName" />
<result property="parentThreeLevelName" column="parentTwoLevelName" />
<result property="parentFourLevelName" column="parentOneLevelName" />
</resultMap>
<sql id="selectTypeVo">
select type_id, type_name, parent_id, storage_num, type_code, model_code, unit_id, manage_type, lease_price, eff_time, rent_price, buy_price, pay_ratio, level, rated_load, test_load, holding_time, warn_num, del_flag, create_by, create_time, update_by, update_time, is_plan, is_ancuo, remark, fac_model, intelligent_code from ma_type
select
type_id, type_name, parent_id, storage_num, type_code, model_code, unit_id, manage_type, lease_price,
eff_time, rent_price, buy_price, pay_ratio, level, rated_load, test_load, holding_time, warn_num,
create_by, create_time, update_by, update_time, is_plan,is_ancuo, remark, fac_model, intelligent_code
from ma_type
</sql>
<select id="selectTypeList" parameterType="com.bonus.material.ma.domain.Type" resultMap="TypeResult">
<include refid="selectTypeVo"/>
<where>
<if test="typeName != null and typeName != ''"> and type_name like concat('%', #{typeName}, '%')</if>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="parentId != null and parentId != '0' "> and parent_id = #{parentId}</if>
<if test="storageNum != null "> and storage_num = #{storageNum}</if>
<if test="typeCode != null and typeCode != ''"> and type_code = #{typeCode}</if>
<if test="modelCode != null and modelCode != ''"> and model_code = #{modelCode}</if>
@ -53,7 +93,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="rentPrice != null "> and rent_price = #{rentPrice}</if>
<if test="buyPrice != null "> and buy_price = #{buyPrice}</if>
<if test="payRatio != null "> and pay_ratio = #{payRatio}</if>
<if test="level != null and level != ''"> and level = #{level}</if>
<if test="level != null and level != ''"> and `level` = #{level}</if>
<if test="ratedLoad != null and ratedLoad != ''"> and rated_load = #{ratedLoad}</if>
<if test="testLoad != null and testLoad != ''"> and test_load = #{testLoad}</if>
<if test="holdingTime != null "> and holding_time = #{holdingTime}</if>
@ -62,6 +102,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isAncuo != null and isAncuo != ''"> and is_ancuo = #{isAncuo}</if>
<if test="facModel != null and facModel != ''"> and fac_model = #{facModel}</if>
<if test="intelligentCode != null and intelligentCode != ''"> and intelligent_code = #{intelligentCode}</if>
and del_flag = #{delFlag}
</where>
</select>
@ -69,6 +110,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectTypeVo"/>
where type_id = #{typeId}
</select>
<select id="selectParentId" resultType="java.lang.Integer">
SELECT DISTINCT
mt2.type_id
FROM
ma_type mt
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id
<where>
<if test="level == 1">
and mt4.type_id = #{typeId}
</if>
<if test="level == 2">
and mt3.type_id = #{typeId}
</if>
<if test="level == 3">
and mt2.type_id = #{typeId}
</if>
<if test="level == 0">
and mt.level = 4
</if>
and mt2.type_id is not null
</where>
</select>
<insert id="insertType" parameterType="com.bonus.material.ma.domain.Type" useGeneratedKeys="true" keyProperty="typeId">
insert into ma_type
@ -85,12 +151,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="rentPrice != null">rent_price,</if>
<if test="buyPrice != null">buy_price,</if>
<if test="payRatio != null">pay_ratio,</if>
<if test="level != null">level,</if>
<if test="level != null">`level`,</if>
<if test="ratedLoad != null">rated_load,</if>
<if test="testLoad != null">test_load,</if>
<if test="holdingTime != null">holding_time,</if>
<if test="warnNum != null">warn_num,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
@ -119,7 +184,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="testLoad != null">#{testLoad},</if>
<if test="holdingTime != null">#{holdingTime},</if>
<if test="warnNum != null">#{warnNum},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
@ -147,14 +211,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="rentPrice != null">rent_price = #{rentPrice},</if>
<if test="buyPrice != null">buy_price = #{buyPrice},</if>
<if test="payRatio != null">pay_ratio = #{payRatio},</if>
<if test="level != null">level = #{level},</if>
<if test="level != null">`level` = #{level},</if>
<if test="ratedLoad != null">rated_load = #{ratedLoad},</if>
<if test="testLoad != null">test_load = #{testLoad},</if>
<if test="holdingTime != null">holding_time = #{holdingTime},</if>
<if test="warnNum != null">warn_num = #{warnNum},</if>
<if test="delFlag != null">del_flag = #{delFlag},</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="isPlan != null">is_plan = #{isPlan},</if>
@ -170,10 +231,104 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
delete from ma_type where type_id = #{typeId}
</delete>
<delete id="deleteTypeByTypeIds" parameterType="String">
delete from ma_type where type_id in
<delete id="logicDeleteTypeByTypeIds" parameterType="String">
update ma_type set del_flag = 2 where type_id in
<foreach item="typeId" collection="array" open="(" separator="," close=")">
#{typeId}
</foreach>
</delete>
<update id="logicDeleteTypeByTypeId">
update ma_type set del_flag = 2 where type_id = #{typeId,jdbcType=BIGINT}
</update>
<select id="selectMaTypeTree" resultMap="TypeResult">
<include refid="selectTypeVo" />
where del_flag = 0 and level != #{level}
</select>
<select id="selectTypeListAndParent" resultMap="MaTypeListVoResult">
SELECT
a.*, -- 当前层级的所有字段
b.type_name AS parentThreeLevelName, -- 父层级名称
c.type_name AS parentTwoLevelName, -- 祖父层级名称
d.type_name AS parentOneLevelName -- 曾祖父层级名称
FROM
ma_type a
LEFT JOIN
ma_type b ON a.parent_id = b.type_id and b.del_flag = '0' -- 第一层,父类型
LEFT JOIN
ma_type c ON b.parent_id = c.type_id and c.del_flag = '0' -- 第二层,祖父类型
LEFT JOIN
ma_type d ON c.parent_id = d.type_id and d.del_flag = '0' -- 第三层,曾祖父类型
<where>
<if test="typeName != null and typeName != ''"> and a.type_name like concat('%', #{typeName}, '%')</if>
<if test="parentId != null and parentId != '0' "> and a.parent_id = #{parentId}</if>
<if test="storageNum != null "> and a.storage_num = #{storageNum}</if>
<if test="typeCode != null and typeCode != ''"> and a.type_code = #{typeCode}</if>
<if test="modelCode != null and modelCode != ''"> and a.model_code = #{modelCode}</if>
<if test="unitId != null "> and a.unit_id = #{unitId}</if>
<if test="manageType != null and manageType != ''"> and a.manage_type = #{manageType}</if>
<if test="leasePrice != null "> and a.lease_price = #{leasePrice}</if>
<if test="effTime != null "> and a.eff_time = #{effTime}</if>
<if test="rentPrice != null "> and a.rent_price = #{rentPrice}</if>
<if test="buyPrice != null "> and a.buy_price = #{buyPrice}</if>
<if test="payRatio != null "> and a.pay_ratio = #{payRatio}</if>
<if test="level != null and level != ''"> and a.`level` = #{level}</if>
<if test="ratedLoad != null and ratedLoad != ''"> and a.rated_load = #{ratedLoad}</if>
<if test="testLoad != null and testLoad != ''"> and a.test_load = #{testLoad}</if>
<if test="holdingTime != null "> and a.holding_time = #{holdingTime}</if>
<if test="warnNum != null "> and a.warn_num = #{warnNum}</if>
<if test="isPlan != null and isPlan != ''"> and a.is_plan = #{isPlan}</if>
<if test="isAncuo != null and isAncuo != ''"> and a.is_ancuo = #{isAncuo}</if>
<if test="facModel != null and facModel != ''"> and a.fac_model = #{facModel}</if>
<if test="intelligentCode != null and intelligentCode != ''"> and a.intelligent_code = #{intelligentCode}</if>
and a.del_flag = '0'
</where>
</select>
<select id="getListByTypeName" resultMap="TypeResult">
select DISTINCT
m.type_id, m.type_name, m.parent_id, m.manage_type,
m.lease_price,m.rent_price, m.eff_time, m.buy_price, m.level, m.rated_load, m.test_load,
m.holding_time, m.warn_num,
mtk.user_id keeperUserId,
mpi.prop_name, m.del_flag, m.create_by, m.create_time,
m.remark, m.fac_model as facModel,m.intelligent_code
from
ma_type m
left join
ma_prop_set mps on m.type_id = mps.type_id
left join
ma_prop_info mpi on mps.prop_id = mpi.prop_id
left join
ma_type_keeper mtk on m.type_id = mtk.type_id
where
m.parent_id = #{typeId} and m.del_flag = '0'
<if test="typeName != null and typeName !=''">
AND type_name like concat('%',#{typeName},'%')
</if>
</select>
<select id="selectMaTypeListByHouseId" resultType="com.bonus.material.ma.vo.MaTypeSelectVo">
select
wh_house_set.type_id AS typeId,
mt.type_name AS typeName,mt.parent_id AS parentId,mt.level
from
wh_house_set
left join
ma_type mt on wh_house_set.type_id = mt.type_id
where
wh_house_set.house_id = #{mouseId} and wh_house_set.del_flag = 0
</select>
<select id="getMaTypeSelectVoListByParentId" resultType="com.bonus.material.ma.vo.MaTypeSelectVo">
select
type_id,type_name,parent_id,level
from
ma_type
where
parent_id = #{typeId} and del_flag = 0
</select>
</mapper>

View File

@ -6,6 +6,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="com.bonus.material.warehouse.domain.WhHouseInfo" id="WhHouseInfoResult">
<result property="houseId" column="house_id" />
<result property="houseName" column="house_name" />
<result property="physicalName" column="physical_name" />
<result property="geoLocation" column="geo_location" />
<result property="parentId" column="parent_id" />
<result property="status" column="status" />
<result property="deptId" column="dept_id" />
@ -22,13 +24,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectWhHouseInfoVo">
select house_id, house_name, parent_id, status, dept_id, del_flag, create_by, create_time, update_by, update_time, remark, company_id, sort, concat, phone from wh_house_info
select house_id, house_name, physical_name, geo_location, parent_id, status, dept_id, del_flag, create_by, create_time, update_by, update_time, remark, company_id, sort, concat, phone from wh_house_info
</sql>
<select id="selectWhHouseInfoList" parameterType="com.bonus.material.warehouse.domain.WhHouseInfo" resultMap="WhHouseInfoResult">
<include refid="selectWhHouseInfoVo"/>
<where>
<if test="houseName != null and houseName != ''"> and house_name like concat('%', #{houseName}, '%')</if>
<if test="physicalName != null and physicalName != ''"> and physical_name like concat('%', #{physicalName}, '%')</if>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
@ -48,6 +51,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into wh_house_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="houseName != null and houseName != ''">house_name,</if>
<if test="physicalName != null and physicalName != ''">physical_name,</if>
<if test="geoLocation != null and geoLocation != ''">geo_location,</if>
<if test="parentId != null">parent_id,</if>
<if test="status != null">status,</if>
<if test="deptId != null">dept_id,</if>
@ -64,6 +69,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="houseName != null and houseName != ''">#{houseName},</if>
<if test="physicalName != null and physicalName != ''">#{physicalName},</if>
<if test="geoLocation != null and geoLocation != ''">#{geoLocation},</if>
<if test="parentId != null">#{parentId},</if>
<if test="status != null">#{status},</if>
<if test="deptId != null">#{deptId},</if>
@ -84,6 +91,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update wh_house_info
<trim prefix="SET" suffixOverrides=",">
<if test="houseName != null and houseName != ''">house_name = #{houseName},</if>
<if test="physicalName != null and physicalName != ''">physical_name = #{physicalName},</if>
<if test="geoLocation != null and geoLocation != ''">geo_location = #{geoLocation},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="status != null">status = #{status},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
@ -102,11 +111,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteWhHouseInfoByHouseId" parameterType="Long">
delete from wh_house_info where house_id = #{houseId}
update wh_house_info set del_flag = '2' where house_id = #{houseId}
</delete>
<delete id="deleteWhHouseInfoByHouseIds" parameterType="String">
delete from wh_house_info where house_id in
update wh_house_info set del_flag = '2' where house_id in
<foreach item="houseId" collection="array" open="(" separator="," close=")">
#{houseId}
</foreach>

View File

@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="com.bonus.material.warehouse.domain.WhHouseSet" id="WhHouseSetResult">
<result property="id" column="id" />
<result property="houseId" column="house_id" />
<result property="houseName" column="house_name" />
<result property="typeId" column="type_id" />
<result property="maId" column="ma_id" />
<result property="num" column="num" />
@ -111,4 +112,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<select id="selectListByMaType" resultMap="WhHouseSetResult">
SELECT
mhs.house_id, mhs.type_id, mhs.ma_id, mhs.num, mhs.status, mhs.dept_id, mhs.del_flag,
mhs.create_by, mhs.create_time, mhs.update_by,mhs.update_time,mhs.remark,mhs.company_id,mhi.house_name
from wh_house_set mhs
left join ma_type mt on mt.type_id = mhs.type_id
left join ma_type mt1 on mt.parent_id = mt1.type_id
left join ma_type mt2 on mt1.parent_id = mt2.type_id
left join wh_house_info mhi on mhs.house_id = mhi.house_id
</select>
</mapper>