合并代码
This commit is contained in:
commit
c8cd712ed1
|
|
@ -14,8 +14,45 @@ public class MaterialConstants
|
|||
public static final String UTF8 = "UTF-8";
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
* 领料任务类型
|
||||
*/
|
||||
public static final Long LEASE_TASK_TYPE = 2L;
|
||||
|
||||
/**
|
||||
* XLS
|
||||
*/
|
||||
public static final String XLS = "xls";
|
||||
|
||||
/**
|
||||
* XLSX
|
||||
*/
|
||||
public static final String XLSX = "xlsx";
|
||||
|
||||
/**
|
||||
* 身份证正则表达式
|
||||
*/
|
||||
public static final String CREDENTIALS_CODE_PATTERN = "^[1-9]\\d{5}[1-9]\\d{3}((0[1-9])|(1[0-2]))(0[1-9]|([1|2][0-9])|3[0-1])((\\d{4})|\\d{3}X)$";
|
||||
|
||||
/**
|
||||
* 经度正则表达式
|
||||
*/
|
||||
public static final String LONGITUDE_PATTERN = "^(-?(180(\\.0+)?|1[0-7][0-9](\\.\\d{1,6})?|[1-9]?\\d(\\.\\d{1,6})?))$";
|
||||
|
||||
/**
|
||||
* 纬度正则表达式
|
||||
*/
|
||||
public static final String LATITUDE_PATTERN = "^(-?(90(\\.0+)?|[1-8]?\\d(\\.\\d{1,6})?))$";
|
||||
|
||||
public static final String ZERO_CONSTANT = "0";
|
||||
|
||||
public static final String ONE_CONSTANT = "1";
|
||||
|
||||
public static final String TWO_CONSTANT = "2";
|
||||
|
||||
public static final String THREE_CONSTANT = "3";
|
||||
|
||||
public static final String FOUR_CONSTANT = "4";
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,77 @@
|
|||
package com.bonus.common.biz.domain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author ma_sh
|
||||
* @create 2024/10/16 10:17
|
||||
*/
|
||||
public class TreeBuild {
|
||||
|
||||
public List<TreeNode> nodeList = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 构造方法
|
||||
* @param nodeList 将数据集合赋值给nodeList,即所有数据作为所有节点。
|
||||
*/
|
||||
public TreeBuild(List<TreeNode> nodeList){
|
||||
this.nodeList = nodeList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取需构建的所有根节点(顶级节点) "0"
|
||||
* @return 所有根节点List集合
|
||||
*/
|
||||
public List<TreeNode> getRootNode(){
|
||||
// 保存所有根节点(所有根节点的数据)
|
||||
List<TreeNode> rootNodeList = new ArrayList<>();
|
||||
// treeNode:查询出的每一条数据(节点)
|
||||
for (TreeNode treeNode : nodeList){
|
||||
// 判断当前节点是否为根节点,此处注意:若parentId类型是String,则要采用equals()方法判断。
|
||||
if (0 == treeNode.getParentId()) {
|
||||
// 是,添加
|
||||
rootNodeList.add(treeNode);
|
||||
}
|
||||
}
|
||||
return rootNodeList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据每一个顶级节点(根节点)进行构建树形结构
|
||||
* @return 构建整棵树
|
||||
*/
|
||||
public List<TreeNode> buildTree(){
|
||||
// treeNodes:保存一个顶级节点所构建出来的完整树形
|
||||
List<TreeNode> treeNodes = new ArrayList<TreeNode>();
|
||||
// getRootNode():获取所有的根节点
|
||||
for (TreeNode treeRootNode : getRootNode()) {
|
||||
// 将顶级节点进行构建子树
|
||||
treeRootNode = buildChildTree(treeRootNode);
|
||||
// 完成一个顶级节点所构建的树形,增加进来
|
||||
treeNodes.add(treeRootNode);
|
||||
}
|
||||
return treeNodes;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归-----构建子树形结构
|
||||
* @param pNode 根节点(顶级节点)
|
||||
* @return 整棵树
|
||||
*/
|
||||
public TreeNode buildChildTree(TreeNode pNode){
|
||||
List<TreeNode> childTree = new ArrayList<TreeNode>();
|
||||
// nodeList:所有节点集合(所有数据)
|
||||
for (TreeNode treeNode : nodeList) {
|
||||
// 判断当前节点的父节点ID是否等于根节点的ID,即当前节点为其下的子节点
|
||||
if (treeNode.getParentId() == pNode.getId()) {
|
||||
// 再递归进行判断当前节点的情况,调用自身方法
|
||||
childTree.add(buildChildTree(treeNode));
|
||||
}
|
||||
}
|
||||
// for循环结束,即节点下没有任何节点,树形构建结束,设置树结果
|
||||
pNode.setChildren(childTree);
|
||||
return pNode;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package com.bonus.common.biz.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author ma_sh
|
||||
* @create 2024/10/16 10:16
|
||||
*/
|
||||
@Data
|
||||
public class TreeNode {
|
||||
|
||||
private long id;
|
||||
|
||||
private String label;
|
||||
|
||||
private long parentId;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private String level;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private String unitName;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private String companyId;
|
||||
|
||||
private String code;
|
||||
|
||||
/** 原值 */
|
||||
@ApiModelProperty(value = "原值")
|
||||
private BigDecimal buyPrice;
|
||||
|
||||
/** 实时库存 */
|
||||
@ApiModelProperty(value = "实时库存")
|
||||
private Long storageNum;
|
||||
|
||||
private String remark;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private List<TreeNode> children = new ArrayList<>();
|
||||
}
|
||||
|
|
@ -10,8 +10,11 @@ import lombok.Getter;
|
|||
public enum HttpCodeEnum {
|
||||
// 成功
|
||||
SUCCESS(200, "操作成功"),
|
||||
//失败
|
||||
FAIL(400, "操作失败,请联系管理员"),
|
||||
// 登录
|
||||
NEED_LOGIN(401, "需要登录后操作"),
|
||||
TO_PARAM_NULL(1007, "参数为空"),
|
||||
NO_OPERATOR_AUTH(403, "无权限操作"),
|
||||
SYSTEM_ERROR(500, "出现错误"),
|
||||
USERNAME_EXIST(501, "用户名已存在"),
|
||||
|
|
@ -26,6 +29,10 @@ public enum HttpCodeEnum {
|
|||
EMAIL_NOT_NULL(511, "邮箱不能为空"),
|
||||
NICKNAME_EXIST(512, "昵称已存在"),
|
||||
LOGIN_ERROR(505, "用户名或密码错误"),
|
||||
NAME_DUPLICATE(1000, "名称重复,请重新输入"),
|
||||
INVALID_LONGITUDE_FORMAT(1001, "经度格式不正确"),
|
||||
INVALID_LATITUDE_FORMAT(1002, "纬度格式不正确"),
|
||||
INVALID_PHONE_FORMAT(1003, "手机号格式不正确"),
|
||||
REPEATE_ERROR(600, "不允许重复提交,请稍候再试");
|
||||
|
||||
private final int code;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,119 @@
|
|||
package com.bonus.material.basic.controller;
|
||||
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
import com.bonus.material.basic.domain.BmAssetAttributes;
|
||||
import com.bonus.material.basic.service.BmAssetAttributesService;
|
||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 资产属性表(BmAssetAttributes)表控制层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-10-15 10:38:58
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/bm_asset_attributes")
|
||||
public class BmAssetAttributesController extends BaseController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private BmAssetAttributesService bmAssetAttributesService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param bmAssetAttributes 筛选条件
|
||||
* @return 查询结果
|
||||
*/
|
||||
@RequiresPermissions("basic:asset:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo queryByPage(BmAssetAttributes bmAssetAttributes) {
|
||||
startPage();
|
||||
List<BmAssetAttributes> list = bmAssetAttributesService.queryByPage(bmAssetAttributes);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@RequiresPermissions("basic:asset:query")
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult queryById(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(bmAssetAttributesService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param bmAssetAttributes 实体
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PreventRepeatSubmit
|
||||
@RequiresPermissions("basic:asset:add")
|
||||
@SysLog(title = "资产属性管理", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增资产属性管理")
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody BmAssetAttributes bmAssetAttributes) {
|
||||
return bmAssetAttributesService.insert(bmAssetAttributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑数据
|
||||
*
|
||||
* @param bmAssetAttributes 实体
|
||||
* @return 编辑结果
|
||||
*/
|
||||
@PreventRepeatSubmit
|
||||
@RequiresPermissions("basic:asset:edit")
|
||||
@SysLog(title = "资产属性管理", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->修改资产属性管理")
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody BmAssetAttributes bmAssetAttributes) {
|
||||
return bmAssetAttributesService.update(bmAssetAttributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 删除是否成功
|
||||
*/
|
||||
@PreventRepeatSubmit
|
||||
@RequiresPermissions("basic:asset:remove")
|
||||
@SysLog(title = "资产属性管理", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除资产属性管理")
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult deleteById(@PathVariable("id") Long id) {
|
||||
return bmAssetAttributesService.deleteById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出资产属性管理列表
|
||||
*/
|
||||
@ApiOperation(value = "导出资产属性管理列表")
|
||||
@PreventRepeatSubmit
|
||||
@RequiresPermissions("basic:asset:export")
|
||||
@SysLog(title = "资产属性管理", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出资产属性管理")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, BmAssetAttributes bmAssetAttributes)
|
||||
{
|
||||
List<BmAssetAttributes> list = bmAssetAttributesService.queryByPage(bmAssetAttributes);
|
||||
ExcelUtil<BmAssetAttributes> util = new ExcelUtil<BmAssetAttributes>(BmAssetAttributes.class);
|
||||
util.exportExcel(response, list, "资产属性管理数据");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -2,8 +2,12 @@ package com.bonus.material.basic.controller;
|
|||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import cn.hutool.http.HttpException;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||
import com.bonus.material.common.utils.HttpClient;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -87,7 +91,7 @@ public class BmProjectController extends BaseController
|
|||
@PostMapping
|
||||
public AjaxResult add(@RequestBody BmProject bmProject)
|
||||
{
|
||||
return toAjax(bmProjectService.insertBmProject(bmProject));
|
||||
return bmProjectService.insertBmProject(bmProject);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -100,7 +104,7 @@ public class BmProjectController extends BaseController
|
|||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody BmProject bmProject)
|
||||
{
|
||||
return toAjax(bmProjectService.updateBmProject(bmProject));
|
||||
return bmProjectService.updateBmProject(bmProject);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -110,9 +114,25 @@ public class BmProjectController extends BaseController
|
|||
@PreventRepeatSubmit
|
||||
@RequiresPermissions("basic:project:remove")
|
||||
@SysLog(title = "标段工程管理", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除标段工程管理")
|
||||
@DeleteMapping("/{proIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] proIds)
|
||||
@DeleteMapping("/{proId}")
|
||||
public AjaxResult remove(@PathVariable Long proId)
|
||||
{
|
||||
return toAjax(bmProjectService.deleteBmProjectByProIds(proIds));
|
||||
return bmProjectService.deleteBmProjectByProId(proId);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "从第三方获取i8工程信息")
|
||||
@GetMapping("/getProjectList")
|
||||
public AjaxResult getProjectList(String token)
|
||||
{
|
||||
try {
|
||||
String url = "http://10.138.55.105:8097/data-center/dc-base/api/project/list";
|
||||
//String url = "http://192.168.1.167:8097/data-center/dc-base/api/project/list";
|
||||
String res = HttpClient.sendGet(url,token);
|
||||
JSONObject jsonObject = JSONObject.parseObject(res);
|
||||
return AjaxResult.success(jsonObject);
|
||||
} catch (HttpException e) {
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,19 @@
|
|||
package com.bonus.material.basic.controller;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.bonus.common.core.constant.SecurityConstants;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||
import com.bonus.system.api.RemoteDictDataService;
|
||||
import com.bonus.system.api.domain.SysDictData;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -38,6 +48,9 @@ public class BmUnitController extends BaseController
|
|||
@Autowired
|
||||
private IBmUnitService bmUnitService;
|
||||
|
||||
@Resource
|
||||
private RemoteDictDataService remoteDictDataService;
|
||||
|
||||
/**
|
||||
* 查询往来单位管理列表
|
||||
*/
|
||||
|
|
@ -48,6 +61,7 @@ public class BmUnitController extends BaseController
|
|||
{
|
||||
startPage();
|
||||
List<BmUnit> list = bmUnitService.selectBmUnitList(bmUnit);
|
||||
extracted(list);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
|
@ -62,10 +76,37 @@ public class BmUnitController extends BaseController
|
|||
public void export(HttpServletResponse response, BmUnit bmUnit)
|
||||
{
|
||||
List<BmUnit> list = bmUnitService.selectBmUnitList(bmUnit);
|
||||
extracted(list);
|
||||
ExcelUtil<BmUnit> util = new ExcelUtil<BmUnit>(BmUnit.class);
|
||||
util.exportExcel(response, list, "往来单位管理数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 将字典数据转换为 BmUnit 对象
|
||||
* @param list
|
||||
*/
|
||||
private void extracted(List<BmUnit> list) {
|
||||
AjaxResult ajaxResult = remoteDictDataService.dictType("bm_unit_type", SecurityConstants.INNER);
|
||||
// 假设 ajaxResult.get("data") 返回的是 List<LinkedHashMap>
|
||||
List<LinkedHashMap> rawData = (List<LinkedHashMap>) ajaxResult.get("data");
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
// 将 rawData 转换为 SysDictData 列表
|
||||
List<SysDictData> dataList = rawData.stream()
|
||||
.map(rawDatum -> objectMapper.convertValue(rawDatum, SysDictData.class))
|
||||
.collect(Collectors.toList());
|
||||
// 使用 Map 存储字典数据以提高查找速度
|
||||
Map<String, String> dictMap = dataList.stream()
|
||||
.collect(Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel));
|
||||
// 更新 BmUnit 列表
|
||||
list.forEach(unit -> {
|
||||
String typeName = dictMap.get(unit.getTypeId().toString());
|
||||
if (typeName != null) {
|
||||
unit.setTypeName(typeName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取往来单位管理详细信息
|
||||
*/
|
||||
|
|
@ -87,7 +128,7 @@ public class BmUnitController extends BaseController
|
|||
@PostMapping
|
||||
public AjaxResult add(@RequestBody BmUnit bmUnit)
|
||||
{
|
||||
return toAjax(bmUnitService.insertBmUnit(bmUnit));
|
||||
return bmUnitService.insertBmUnit(bmUnit);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -100,7 +141,7 @@ public class BmUnitController extends BaseController
|
|||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody BmUnit bmUnit)
|
||||
{
|
||||
return toAjax(bmUnitService.updateBmUnit(bmUnit));
|
||||
return bmUnitService.updateBmUnit(bmUnit);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -111,8 +152,8 @@ public class BmUnitController extends BaseController
|
|||
@RequiresPermissions("basic:unit:remove")
|
||||
@SysLog(title = "往来单位管理", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除往来单位管理")
|
||||
@DeleteMapping("/{unitIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] unitIds)
|
||||
public AjaxResult remove(@PathVariable Long unitId)
|
||||
{
|
||||
return toAjax(bmUnitService.deleteBmUnitByUnitIds(unitIds));
|
||||
return bmUnitService.deleteBmUnitByUnitId(unitId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,16 @@
|
|||
package com.bonus.material.basic.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.common.biz.domain.TreeSelect;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||
import com.bonus.system.api.RemoteUserService;
|
||||
import com.bonus.system.api.domain.SysDept;
|
||||
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;
|
||||
|
|
@ -21,8 +22,10 @@ import com.bonus.material.basic.domain.BmUnitPerson;
|
|||
import com.bonus.material.basic.service.IBmUnitPersonService;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 往来单位管理Controller
|
||||
|
|
@ -38,81 +41,61 @@ public class BmUnitPersonController extends BaseController
|
|||
@Autowired
|
||||
private IBmUnitPersonService bmUnitPersonService;
|
||||
|
||||
@Resource
|
||||
private RemoteUserService remoteUserService;
|
||||
|
||||
/**
|
||||
* 查询往来单位管理列表
|
||||
* 查询部门下拉树
|
||||
*/
|
||||
@ApiOperation(value = "查询往来单位管理列表")
|
||||
@RequiresPermissions("basic:person:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(BmUnitPerson bmUnitPerson)
|
||||
{
|
||||
startPage();
|
||||
List<BmUnitPerson> list = bmUnitPersonService.selectBmUnitPersonList(bmUnitPerson);
|
||||
return getDataTable(list);
|
||||
@ApiOperation(value = "查询部门下拉树")
|
||||
@GetMapping("/getDeptUserTree")
|
||||
public AjaxResult selectDeptTree(SysDept dept) {
|
||||
AjaxResult ajaxResult = remoteUserService.deptTree(dept, null);
|
||||
List<TreeSelect> data = (List<TreeSelect>) ajaxResult.get("data");
|
||||
if (CollectionUtils.isEmpty(data)) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
List<TreeSelect> branches = getBranches(data);
|
||||
return AjaxResult.success(branches);
|
||||
}
|
||||
|
||||
private List<TreeSelect> getBranches(List<TreeSelect> data) {
|
||||
List<TreeSelect> branches = new ArrayList<>();
|
||||
for (TreeSelect company : data) {
|
||||
if (company.getChildren() != null) {
|
||||
for (TreeSelect child : company.getChildren()) {
|
||||
// 添加分公司
|
||||
branches.add(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
return branches;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出往来单位管理列表
|
||||
* 绑定往来单位人员列表
|
||||
*/
|
||||
@ApiOperation(value = "导出往来单位管理列表")
|
||||
@ApiOperation(value = "绑定往来单位人员列表")
|
||||
@PreventRepeatSubmit
|
||||
@RequiresPermissions("basic:person:export")
|
||||
@SysLog(title = "往来单位管理", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出往来单位管理")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, BmUnitPerson bmUnitPerson)
|
||||
@RequiresPermissions("basic:person:bind")
|
||||
@SysLog(title = "往来单位人员管理", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->绑定往来单位人员")
|
||||
@PostMapping("/bind")
|
||||
public AjaxResult bind(@RequestBody BmUnitPerson bmUnitPerson)
|
||||
{
|
||||
List<BmUnitPerson> list = bmUnitPersonService.selectBmUnitPersonList(bmUnitPerson);
|
||||
ExcelUtil<BmUnitPerson> util = new ExcelUtil<BmUnitPerson>(BmUnitPerson.class);
|
||||
util.exportExcel(response, list, "往来单位管理数据");
|
||||
return bmUnitPersonService.insertBmUnitPerson(bmUnitPerson);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取往来单位管理详细信息
|
||||
*/
|
||||
@ApiOperation(value = "获取往来单位管理详细信息")
|
||||
@RequiresPermissions("basic:person:query")
|
||||
@GetMapping(value = "/{ID}")
|
||||
public AjaxResult getInfo(@PathVariable("ID") Long ID)
|
||||
{
|
||||
return success(bmUnitPersonService.selectBmUnitPersonByID(ID));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增往来单位管理
|
||||
* 解绑往来单位人员列表
|
||||
*/
|
||||
@ApiOperation(value = "新增往来单位管理")
|
||||
@PreventRepeatSubmit
|
||||
@RequiresPermissions("basic:person:add")
|
||||
@SysLog(title = "往来单位管理", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增往来单位管理")
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody BmUnitPerson bmUnitPerson)
|
||||
{
|
||||
return toAjax(bmUnitPersonService.insertBmUnitPerson(bmUnitPerson));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改往来单位管理
|
||||
*/
|
||||
@ApiOperation(value = "修改往来单位管理")
|
||||
@PreventRepeatSubmit
|
||||
@RequiresPermissions("basic:person:edit")
|
||||
@SysLog(title = "往来单位管理", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改往来单位管理")
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody BmUnitPerson bmUnitPerson)
|
||||
{
|
||||
return toAjax(bmUnitPersonService.updateBmUnitPerson(bmUnitPerson));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除往来单位管理
|
||||
*/
|
||||
@ApiOperation(value = "删除往来单位管理")
|
||||
@ApiOperation(value = "解绑往来单位人员列表")
|
||||
@PreventRepeatSubmit
|
||||
@RequiresPermissions("basic:person:remove")
|
||||
@SysLog(title = "往来单位管理", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除往来单位管理")
|
||||
@DeleteMapping("/{IDs}")
|
||||
public AjaxResult remove(@PathVariable Long[] IDs)
|
||||
@SysLog(title = "往来单位管理", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->解绑往来单位人员")
|
||||
@DeleteMapping("/{unitId}")
|
||||
public AjaxResult unbind(@PathVariable Long unitId)
|
||||
{
|
||||
return toAjax(bmUnitPersonService.deleteBmUnitPersonByIDs(IDs));
|
||||
return bmUnitPersonService.deleteBmUnitPersonByID(unitId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
package com.bonus.material.basic.domain;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 资产属性表(BmAssetAttributes)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-10-15 10:39:00
|
||||
*/
|
||||
@Data
|
||||
public class BmAssetAttributes extends BaseEntity implements Serializable {
|
||||
private static final long serialVersionUID = -16238021609223792L;
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 资产类型名称
|
||||
*/
|
||||
@Excel(name = "资产类型名称")
|
||||
private String assetName;
|
||||
|
||||
/**
|
||||
* 资产编码
|
||||
*/
|
||||
@Excel(name = "资产编码")
|
||||
private String assetCode;
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -31,27 +31,45 @@ public class BmProject extends BaseEntity
|
|||
private String proName;
|
||||
|
||||
/** 关联外部(第三方)的工程ID */
|
||||
@Excel(name = "关联外部(第三方)的工程ID")
|
||||
@ApiModelProperty(value = "关联外部(第三方)的工程ID")
|
||||
private String externalId;
|
||||
|
||||
/** 外部(第三方)的工程详情json */
|
||||
@Excel(name = "外部(第三方)的工程详情json")
|
||||
@ApiModelProperty(value = "外部(第三方)的工程详情json")
|
||||
private String externalInfo;
|
||||
|
||||
/** 工程类型(0线路,1变电,2施工) */
|
||||
@Excel(name = "工程类型(0线路,1变电,2施工)")
|
||||
@ApiModelProperty(value = "工程类型(0线路,1变电,2施工)")
|
||||
/** 工程类型(0线路,1变电,2业务,3其他) */
|
||||
@ApiModelProperty(value = "工程类型(0线路,1变电,2业务,3其他)")
|
||||
private String proTypeId;
|
||||
|
||||
@ApiModelProperty(value = "实施单位")
|
||||
@Excel(name = "实施单位")
|
||||
private String impUnit;
|
||||
|
||||
@ApiModelProperty(value = "工程类型")
|
||||
@Excel(name = "工程类型")
|
||||
private String proType;
|
||||
|
||||
@ApiModelProperty(value = "工程编码")
|
||||
@Excel(name = "i8工程编码")
|
||||
private String proCode;
|
||||
|
||||
/**
|
||||
* 是否匹配i8工程
|
||||
*/
|
||||
@ApiModelProperty(value = "是否匹配i8工程")
|
||||
@Excel(name = "是否匹配i8工程")
|
||||
private String isMatchI8;
|
||||
|
||||
@ApiModelProperty(value = "合同主体")
|
||||
@Excel(name = "合同主体")
|
||||
private String contractPart;
|
||||
|
||||
/** 经度 */
|
||||
@Excel(name = "经度")
|
||||
@ApiModelProperty(value = "经度")
|
||||
private String lon;
|
||||
|
||||
/** 维度 */
|
||||
@Excel(name = "维度")
|
||||
@ApiModelProperty(value = "维度")
|
||||
private String lat;
|
||||
|
||||
|
|
@ -65,32 +83,36 @@ public class BmProject extends BaseEntity
|
|||
@ApiModelProperty(value = "联系方式")
|
||||
private String telphone;
|
||||
|
||||
@ApiModelProperty(value = "工程状态")
|
||||
@Excel(name = "工程状态")
|
||||
private String proStatus;
|
||||
|
||||
/** 计划开工日期 */
|
||||
@ApiModelProperty(value = "计划开工日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "计划开工日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date planStartDate;
|
||||
|
||||
/** 计划结束日期 */
|
||||
@ApiModelProperty(value = "计划结束日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "计划结束日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date planEndDate;
|
||||
|
||||
/** 实际开工日期 */
|
||||
@ApiModelProperty(value = "实际开工日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "实际开工日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date actualStartDate;
|
||||
|
||||
/** 实际完工日期 */
|
||||
@ApiModelProperty(value = "实际完工日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "实际完工日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date actualEndDate;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
@ApiModelProperty(value = "工程性质")
|
||||
private String proNature;
|
||||
|
||||
@ApiModelProperty(value = "所属项目中心")
|
||||
private String proCenter;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ public class BmStorageLog extends BaseEntity
|
|||
/** 退库接收-维修数量 */
|
||||
@Excel(name = "退库接收-维修数量")
|
||||
@ApiModelProperty(value = "退库接收-维修数量")
|
||||
private Long maintenanceNum;
|
||||
private Long repairNum;
|
||||
|
||||
/** 退库接收-报废数量 */
|
||||
@Excel(name = "退库接收-报废数量")
|
||||
|
|
|
|||
|
|
@ -24,19 +24,26 @@ public class BmUnit extends BaseEntity
|
|||
private Long unitId;
|
||||
|
||||
/** 单位类型名称 */
|
||||
@Excel(name = "单位类型名称")
|
||||
@Excel(name = "单位名称")
|
||||
@ApiModelProperty(value = "单位类型名称")
|
||||
private String unitName;
|
||||
|
||||
/** 帐号状态(0正常 1停用) */
|
||||
@Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
|
||||
private String status;
|
||||
|
||||
/** 单位类型 */
|
||||
@Excel(name = "单位类型")
|
||||
@ApiModelProperty(value = "单位类型")
|
||||
private Long typeId;
|
||||
|
||||
@Excel(name = "单位类型")
|
||||
@ApiModelProperty(value = "单位类型名称")
|
||||
private String typeName;
|
||||
|
||||
/** 所属分公司 */
|
||||
@Excel(name = "所属分公司")
|
||||
@ApiModelProperty(value = "所属分公司")
|
||||
private Long deptId;
|
||||
|
||||
/** 联系人 */
|
||||
@Excel(name = "联系人")
|
||||
@ApiModelProperty(value = "联系人")
|
||||
|
|
@ -47,13 +54,13 @@ public class BmUnit extends BaseEntity
|
|||
@ApiModelProperty(value = "联系方式")
|
||||
private String telphone;
|
||||
|
||||
/** 所属组织 */
|
||||
@Excel(name = "所属组织")
|
||||
@ApiModelProperty(value = "所属组织")
|
||||
private Long deptId;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 是否绑定 1 是,0 否
|
||||
*/
|
||||
private Integer isBind;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ import lombok.Data;
|
|||
import lombok.ToString;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 往来单位管理对象 bm_unit_person
|
||||
*
|
||||
|
|
@ -21,9 +23,12 @@ public class BmUnitPerson extends BaseEntity
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long ID;
|
||||
private Long id;
|
||||
|
||||
/** 类型ID */
|
||||
/** 类型ID集合 */
|
||||
private List<Long> unitIdList;
|
||||
|
||||
@ApiModelProperty(value = "类型ID")
|
||||
private Long unitId;
|
||||
|
||||
/** 用户ID */
|
||||
|
|
@ -36,5 +41,8 @@ public class BmUnitPerson extends BaseEntity
|
|||
@ApiModelProperty(value = "数据所属组织")
|
||||
private String companyId;
|
||||
|
||||
|
||||
/**
|
||||
* 二级树标识 1代表查询二级树
|
||||
*/
|
||||
private Integer isTree;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
package com.bonus.material.basic.domain;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author ma_sh
|
||||
* @create 2024/10/14 15:29
|
||||
*/
|
||||
@Data
|
||||
public class BmUnitType extends BaseEntity {
|
||||
|
||||
private Integer isAll;
|
||||
|
||||
@ApiModelProperty(value = "主键id")
|
||||
private Long typeId;
|
||||
|
||||
@ApiModelProperty(value = "单位类型名称")
|
||||
@Excel(name = "单位类型")
|
||||
private String typeName;
|
||||
|
||||
@ApiModelProperty(value = "单位类型")
|
||||
private String dictType;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
package com.bonus.material.basic.mapper;
|
||||
|
||||
import com.bonus.material.basic.domain.BmAssetAttributes;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 资产属性表(BmAssetAttributes)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-10-15 10:38:58
|
||||
*/
|
||||
public interface BmAssetAttributesMapper {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
BmAssetAttributes queryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询指定行数据
|
||||
*
|
||||
* @param bmAssetAttributes 查询条件
|
||||
* @return 对象列表
|
||||
*/
|
||||
List<BmAssetAttributes> queryAllByLimit(BmAssetAttributes bmAssetAttributes);
|
||||
|
||||
/**
|
||||
* 统计总行数
|
||||
*
|
||||
* @param bmAssetAttributes 查询条件
|
||||
* @return 总行数
|
||||
*/
|
||||
long count(BmAssetAttributes bmAssetAttributes);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param bmAssetAttributes 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(BmAssetAttributes bmAssetAttributes);
|
||||
|
||||
/**
|
||||
* 批量新增数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<BmAssetAttributes> 实例对象列表
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insertBatch(@Param("entities") List<BmAssetAttributes> entities);
|
||||
|
||||
/**
|
||||
* 批量新增或按主键更新数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<BmAssetAttributes> 实例对象列表
|
||||
* @return 影响行数
|
||||
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
|
||||
*/
|
||||
int insertOrUpdateBatch(@Param("entities") List<BmAssetAttributes> entities);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param bmAssetAttributes 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(BmAssetAttributes bmAssetAttributes);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 影响行数
|
||||
*/
|
||||
int deleteById(Long id);
|
||||
|
||||
/**
|
||||
* 根据资产名称或编号查询数据
|
||||
* @param bmAssetAttributes
|
||||
* @return
|
||||
*/
|
||||
List<BmAssetAttributes> selectBmAssetAttributesByAssetCode(BmAssetAttributes bmAssetAttributes);
|
||||
}
|
||||
|
||||
|
|
@ -52,10 +52,9 @@ public interface BmProjectMapper
|
|||
public int deleteBmProjectByProId(Long proId);
|
||||
|
||||
/**
|
||||
* 批量删除标段工程管理
|
||||
*
|
||||
* @param proIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
* 根据工程名称查询工程信息
|
||||
* @param bmProject
|
||||
* @return
|
||||
*/
|
||||
public int deleteBmProjectByProIds(Long[] proIds);
|
||||
List<BmProject> selectBmProjectByProName(BmProject bmProject);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,4 +58,18 @@ public interface BmUnitMapper
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteBmUnitByUnitIds(Long[] unitIds);
|
||||
|
||||
/**
|
||||
* 根据单位名查询单位信息
|
||||
* @param unitName
|
||||
* @return
|
||||
*/
|
||||
BmUnit selectBmUnitByProName(String unitName);
|
||||
|
||||
/**
|
||||
* 根据单位id查询单位人员数量
|
||||
* @param unitId
|
||||
* @return
|
||||
*/
|
||||
Integer selectBmUnitPersonByUnitId(Long unitId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.bonus.material.basic.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.bonus.common.biz.domain.TreeNode;
|
||||
import com.bonus.material.basic.domain.BmUnitPerson;
|
||||
|
||||
/**
|
||||
|
|
@ -11,21 +13,6 @@ import com.bonus.material.basic.domain.BmUnitPerson;
|
|||
*/
|
||||
public interface BmUnitPersonMapper
|
||||
{
|
||||
/**
|
||||
* 查询往来单位管理
|
||||
*
|
||||
* @param ID 往来单位管理主键
|
||||
* @return 往来单位管理
|
||||
*/
|
||||
public BmUnitPerson selectBmUnitPersonByID(Long ID);
|
||||
|
||||
/**
|
||||
* 查询往来单位管理列表
|
||||
*
|
||||
* @param bmUnitPerson 往来单位管理
|
||||
* @return 往来单位管理集合
|
||||
*/
|
||||
public List<BmUnitPerson> selectBmUnitPersonList(BmUnitPerson bmUnitPerson);
|
||||
|
||||
/**
|
||||
* 新增往来单位管理
|
||||
|
|
@ -35,27 +22,18 @@ public interface BmUnitPersonMapper
|
|||
*/
|
||||
public int insertBmUnitPerson(BmUnitPerson bmUnitPerson);
|
||||
|
||||
/**
|
||||
* 修改往来单位管理
|
||||
*
|
||||
* @param bmUnitPerson 往来单位管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBmUnitPerson(BmUnitPerson bmUnitPerson);
|
||||
|
||||
/**
|
||||
* 删除往来单位管理
|
||||
*
|
||||
* @param ID 往来单位管理主键
|
||||
* @param unitId 往来单位管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBmUnitPersonByID(Long ID);
|
||||
public int deleteBmUnitPersonByID(Long unitId);
|
||||
|
||||
/**
|
||||
* 批量删除往来单位管理
|
||||
*
|
||||
* @param IDs 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
* 查询部门树
|
||||
* @param unitPerson
|
||||
* @return
|
||||
*/
|
||||
public int deleteBmUnitPersonByIDs(Long[] IDs);
|
||||
List<TreeNode> selectDeptTree(BmUnitPerson unitPerson);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,58 @@
|
|||
package com.bonus.material.basic.service;
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.basic.domain.BmAssetAttributes;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 资产属性表(BmAssetAttributes)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-10-15 10:39:02
|
||||
*/
|
||||
public interface BmAssetAttributesService {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
BmAssetAttributes queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param bmAssetAttributes 筛选条件
|
||||
* @return 查询结果
|
||||
*/
|
||||
List<BmAssetAttributes> queryByPage(BmAssetAttributes bmAssetAttributes);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param bmAssetAttributes 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
AjaxResult insert(BmAssetAttributes bmAssetAttributes);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param bmAssetAttributes 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
AjaxResult update(BmAssetAttributes bmAssetAttributes);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
AjaxResult deleteById(Long id);
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
package com.bonus.material.basic.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.basic.domain.BmProject;
|
||||
|
||||
/**
|
||||
|
|
@ -33,7 +35,7 @@ public interface IBmProjectService
|
|||
* @param bmProject 标段工程管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBmProject(BmProject bmProject);
|
||||
public AjaxResult insertBmProject(BmProject bmProject);
|
||||
|
||||
/**
|
||||
* 修改标段工程管理
|
||||
|
|
@ -41,15 +43,7 @@ public interface IBmProjectService
|
|||
* @param bmProject 标段工程管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBmProject(BmProject bmProject);
|
||||
|
||||
/**
|
||||
* 批量删除标段工程管理
|
||||
*
|
||||
* @param proIds 需要删除的标段工程管理主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBmProjectByProIds(Long[] proIds);
|
||||
public AjaxResult updateBmProject(BmProject bmProject);
|
||||
|
||||
/**
|
||||
* 删除标段工程管理信息
|
||||
|
|
@ -57,5 +51,5 @@ public interface IBmProjectService
|
|||
* @param proId 标段工程管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBmProjectByProId(Long proId);
|
||||
public AjaxResult deleteBmProjectByProId(Long proId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package com.bonus.material.basic.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.basic.domain.BmUnitPerson;
|
||||
|
||||
/**
|
||||
|
|
@ -11,21 +11,6 @@ import com.bonus.material.basic.domain.BmUnitPerson;
|
|||
*/
|
||||
public interface IBmUnitPersonService
|
||||
{
|
||||
/**
|
||||
* 查询往来单位管理
|
||||
*
|
||||
* @param ID 往来单位管理主键
|
||||
* @return 往来单位管理
|
||||
*/
|
||||
public BmUnitPerson selectBmUnitPersonByID(Long ID);
|
||||
|
||||
/**
|
||||
* 查询往来单位管理列表
|
||||
*
|
||||
* @param bmUnitPerson 往来单位管理
|
||||
* @return 往来单位管理集合
|
||||
*/
|
||||
public List<BmUnitPerson> selectBmUnitPersonList(BmUnitPerson bmUnitPerson);
|
||||
|
||||
/**
|
||||
* 新增往来单位管理
|
||||
|
|
@ -33,29 +18,21 @@ public interface IBmUnitPersonService
|
|||
* @param bmUnitPerson 往来单位管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBmUnitPerson(BmUnitPerson bmUnitPerson);
|
||||
|
||||
/**
|
||||
* 修改往来单位管理
|
||||
*
|
||||
* @param bmUnitPerson 往来单位管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBmUnitPerson(BmUnitPerson bmUnitPerson);
|
||||
|
||||
/**
|
||||
* 批量删除往来单位管理
|
||||
*
|
||||
* @param IDs 需要删除的往来单位管理主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBmUnitPersonByIDs(Long[] IDs);
|
||||
public AjaxResult insertBmUnitPerson(BmUnitPerson bmUnitPerson);
|
||||
|
||||
/**
|
||||
* 删除往来单位管理信息
|
||||
*
|
||||
* @param ID 往来单位管理主键
|
||||
* @param unitId 往来单位管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBmUnitPersonByID(Long ID);
|
||||
public AjaxResult deleteBmUnitPersonByID(Long unitId);
|
||||
|
||||
/**
|
||||
* 查询部门下拉树结构
|
||||
* @param unitPerson
|
||||
* @return
|
||||
*/
|
||||
AjaxResult selectDeptTree(BmUnitPerson unitPerson);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.bonus.material.basic.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.basic.domain.BmUnit;
|
||||
|
||||
/**
|
||||
|
|
@ -33,7 +35,7 @@ public interface IBmUnitService
|
|||
* @param bmUnit 往来单位管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBmUnit(BmUnit bmUnit);
|
||||
public AjaxResult insertBmUnit(BmUnit bmUnit);
|
||||
|
||||
/**
|
||||
* 修改往来单位管理
|
||||
|
|
@ -41,7 +43,7 @@ public interface IBmUnitService
|
|||
* @param bmUnit 往来单位管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBmUnit(BmUnit bmUnit);
|
||||
public AjaxResult updateBmUnit(BmUnit bmUnit);
|
||||
|
||||
/**
|
||||
* 批量删除往来单位管理
|
||||
|
|
@ -49,7 +51,7 @@ public interface IBmUnitService
|
|||
* @param unitIds 需要删除的往来单位管理主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBmUnitByUnitIds(Long[] unitIds);
|
||||
public AjaxResult deleteBmUnitByUnitIds(Long[] unitIds);
|
||||
|
||||
/**
|
||||
* 删除往来单位管理信息
|
||||
|
|
@ -57,5 +59,5 @@ public interface IBmUnitService
|
|||
* @param unitId 往来单位管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBmUnitByUnitId(Long unitId);
|
||||
public AjaxResult deleteBmUnitByUnitId(Long unitId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,123 @@
|
|||
package com.bonus.material.basic.service.impl;
|
||||
|
||||
import com.bonus.common.biz.enums.HttpCodeEnum;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.material.basic.domain.BmAssetAttributes;
|
||||
import com.bonus.material.basic.mapper.BmAssetAttributesMapper;
|
||||
import com.bonus.material.basic.service.BmAssetAttributesService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 资产属性表(BmAssetAttributes)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-10-15 10:39:02
|
||||
*/
|
||||
@Service("bmAssetAttributesService")
|
||||
public class BmAssetAttributesServiceImpl implements BmAssetAttributesService {
|
||||
@Resource
|
||||
private BmAssetAttributesMapper bmAssetAttributesDao;
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public BmAssetAttributes queryById(Long id) {
|
||||
return bmAssetAttributesDao.queryById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param bmAssetAttributes 筛选条件
|
||||
* @return 查询结果
|
||||
*/
|
||||
@Override
|
||||
public List<BmAssetAttributes> queryByPage(BmAssetAttributes bmAssetAttributes) {
|
||||
return bmAssetAttributesDao.queryAllByLimit(bmAssetAttributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param bmAssetAttributes 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult insert(BmAssetAttributes bmAssetAttributes) {
|
||||
if (bmAssetAttributes == null) {
|
||||
return AjaxResult.error(HttpCodeEnum.TO_PARAM_NULL.getCode(), HttpCodeEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
//先判断物资类型名称是否存在
|
||||
List<BmAssetAttributes> attributesList = bmAssetAttributesDao.selectBmAssetAttributesByAssetCode(bmAssetAttributes);
|
||||
if (attributesList.size() > 1) {
|
||||
return AjaxResult.error(HttpCodeEnum.NAME_DUPLICATE.getCode(), "资产类型名称或资产编码与库中重复");
|
||||
}
|
||||
if (attributesList.size() == 1) {
|
||||
if (!Objects.equals(attributesList.get(0).getId(), bmAssetAttributes.getId())) {
|
||||
return AjaxResult.error(HttpCodeEnum.NAME_DUPLICATE.getCode(), "资产类型名称或资产编码与库中重复");
|
||||
}
|
||||
}
|
||||
bmAssetAttributes.setCreateBy(SecurityUtils.getUserId().toString());
|
||||
bmAssetAttributes.setCreateTime(DateUtils.getNowDate());
|
||||
int result = bmAssetAttributesDao.insert(bmAssetAttributes);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param bmAssetAttributes 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult update(BmAssetAttributes bmAssetAttributes) {
|
||||
if (bmAssetAttributes == null || bmAssetAttributes.getId() == null) {
|
||||
return AjaxResult.error(HttpCodeEnum.TO_PARAM_NULL.getCode(), HttpCodeEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
//先判断物资类型名称是否存在
|
||||
List<BmAssetAttributes> attributesList = bmAssetAttributesDao.selectBmAssetAttributesByAssetCode(bmAssetAttributes);
|
||||
if (attributesList.size() > 1) {
|
||||
return AjaxResult.error(HttpCodeEnum.NAME_DUPLICATE.getCode(), "资产类型名称或资产编码与库中重复");
|
||||
}
|
||||
if (attributesList.size() == 1) {
|
||||
if (!Objects.equals(attributesList.get(0).getId(), bmAssetAttributes.getId())) {
|
||||
return AjaxResult.error(HttpCodeEnum.NAME_DUPLICATE.getCode(), "资产类型名称或资产编码与库中重复");
|
||||
}
|
||||
}
|
||||
bmAssetAttributes.setUpdateBy(SecurityUtils.getUserId().toString());
|
||||
bmAssetAttributes.setUpdateTime(DateUtils.getNowDate());
|
||||
int result = bmAssetAttributesDao.update(bmAssetAttributes);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult deleteById(Long id) {
|
||||
int result = bmAssetAttributesDao.deleteById(id);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +1,28 @@
|
|||
package com.bonus.material.basic.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import cn.hutool.core.util.PhoneUtil;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.common.biz.constant.MaterialConstants;
|
||||
import com.bonus.common.biz.enums.HttpCodeEnum;
|
||||
import com.bonus.common.biz.exception.BusinessException;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.hibernate.validator.internal.util.StringHelper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bonus.material.basic.mapper.BmProjectMapper;
|
||||
import com.bonus.material.basic.domain.BmProject;
|
||||
import com.bonus.material.basic.service.IBmProjectService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static com.bonus.common.biz.constant.MaterialConstants.*;
|
||||
|
||||
/**
|
||||
* 标段工程管理Service业务层处理
|
||||
*
|
||||
|
|
@ -17,7 +32,7 @@ import com.bonus.material.basic.service.IBmProjectService;
|
|||
@Service
|
||||
public class BmProjectServiceImpl implements IBmProjectService
|
||||
{
|
||||
@Autowired
|
||||
@Resource
|
||||
private BmProjectMapper bmProjectMapper;
|
||||
|
||||
/**
|
||||
|
|
@ -29,7 +44,9 @@ public class BmProjectServiceImpl implements IBmProjectService
|
|||
@Override
|
||||
public BmProject selectBmProjectByProId(Long proId)
|
||||
{
|
||||
return bmProjectMapper.selectBmProjectByProId(proId);
|
||||
BmProject project = bmProjectMapper.selectBmProjectByProId(proId);
|
||||
extracted(project);
|
||||
return project;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -41,7 +58,62 @@ public class BmProjectServiceImpl implements IBmProjectService
|
|||
@Override
|
||||
public List<BmProject> selectBmProjectList(BmProject bmProject)
|
||||
{
|
||||
return bmProjectMapper.selectBmProjectList(bmProject);
|
||||
List<BmProject> list = bmProjectMapper.selectBmProjectList(bmProject);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
list.forEach(item -> {
|
||||
extracted(item);
|
||||
});
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 方法抽取
|
||||
* @param item
|
||||
*/
|
||||
private void extracted(BmProject item) {
|
||||
if (item.getProTypeId() != null) {
|
||||
if (ZERO_CONSTANT.equals(item.getProTypeId())) {
|
||||
item.setProType("线路工程");
|
||||
} else if (ONE_CONSTANT.equals(item.getProTypeId())) {
|
||||
item.setProType("变电工程");
|
||||
} else if (TWO_CONSTANT.equals(item.getProTypeId())) {
|
||||
item.setProType("业务工程");
|
||||
} else if (THREE_CONSTANT.equals(item.getProTypeId())) {
|
||||
item.setProType("其他工程");
|
||||
} else {
|
||||
item.setProType("未知工程类型");
|
||||
}
|
||||
}
|
||||
if (item.getProNature() != null) {
|
||||
if (ZERO_CONSTANT.equals(item.getProNature())) {
|
||||
item.setProNature("基建");
|
||||
} else if (ONE_CONSTANT.equals(item.getProNature())) {
|
||||
item.setProNature("用户工程");
|
||||
} else if (TWO_CONSTANT.equals(item.getProNature())){
|
||||
item.setProNature("技修大改");
|
||||
} else if (THREE_CONSTANT.equals(item.getProNature())) {
|
||||
item.setProNature("其他");
|
||||
} else {
|
||||
item.setProNature("未知工程性质");
|
||||
}
|
||||
}
|
||||
if (item.getProStatus() != null) {
|
||||
if (ZERO_CONSTANT.equals(item.getProStatus())) {
|
||||
item.setProStatus("开工准备");
|
||||
} else if (ONE_CONSTANT.equals(item.getProStatus())) {
|
||||
item.setProStatus("在建");
|
||||
} else if (TWO_CONSTANT.equals(item.getProStatus())){
|
||||
item.setProStatus("停工");
|
||||
} else if (THREE_CONSTANT.equals(item.getProStatus())){
|
||||
item.setProStatus("完工未竣工");
|
||||
} else if (FOUR_CONSTANT.equals(item.getProStatus())) {
|
||||
item.setProStatus("竣工");
|
||||
} else {
|
||||
item.setProStatus("未知工程状态");
|
||||
}
|
||||
}
|
||||
item.setIsMatchI8(StringUtils.isNotEmpty(item.getExternalId()) ? "匹配" : "不匹配");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -51,10 +123,38 @@ public class BmProjectServiceImpl implements IBmProjectService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertBmProject(BmProject bmProject)
|
||||
public AjaxResult insertBmProject(BmProject bmProject)
|
||||
{
|
||||
if (bmProject == null) {
|
||||
return AjaxResult.error(HttpCodeEnum.TO_PARAM_NULL.getCode(), HttpCodeEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
//首先根据工程或名称去表中查询,看是否重复
|
||||
List<BmProject> projectList = bmProjectMapper.selectBmProjectByProName(bmProject);
|
||||
if (CollectionUtils.isNotEmpty(projectList)) {
|
||||
return AjaxResult.error(HttpCodeEnum.NAME_DUPLICATE.getCode(), "工程名称或工程编码与库中重复");
|
||||
}
|
||||
//校验输入的经纬度是否合规
|
||||
if (bmProject.getLon() != null) {
|
||||
if (!bmProject.getLon().matches(MaterialConstants.LONGITUDE_PATTERN)){
|
||||
return AjaxResult.error(HttpCodeEnum.INVALID_LONGITUDE_FORMAT.getCode(), HttpCodeEnum.INVALID_LONGITUDE_FORMAT.getMsg());
|
||||
}
|
||||
}
|
||||
if (bmProject.getLat() != null) {
|
||||
if (!bmProject.getLat().matches(MaterialConstants.LATITUDE_PATTERN)){
|
||||
return AjaxResult.error(HttpCodeEnum.INVALID_LATITUDE_FORMAT.getCode(), HttpCodeEnum.INVALID_LATITUDE_FORMAT.getMsg());
|
||||
}
|
||||
}
|
||||
//判断手机号是否合法
|
||||
if (StringUtils.isNotBlank(bmProject.getTelphone()) && !PhoneUtil.isMobile(bmProject.getTelphone())) {
|
||||
return AjaxResult.error(HttpCodeEnum.INVALID_PHONE_FORMAT.getCode(), HttpCodeEnum.INVALID_PHONE_FORMAT.getMsg());
|
||||
}
|
||||
bmProject.setCreateTime(DateUtils.getNowDate());
|
||||
return bmProjectMapper.insertBmProject(bmProject);
|
||||
bmProject.setCreateBy(SecurityUtils.getUserId().toString());
|
||||
int result = bmProjectMapper.insertBmProject(bmProject);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg(), result);
|
||||
}
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -64,22 +164,43 @@ public class BmProjectServiceImpl implements IBmProjectService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateBmProject(BmProject bmProject)
|
||||
public AjaxResult updateBmProject(BmProject bmProject)
|
||||
{
|
||||
if (bmProject == null || bmProject.getProId() == null) {
|
||||
return AjaxResult.error(HttpCodeEnum.TO_PARAM_NULL.getCode(), HttpCodeEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
//首先根据工程名称去表中查询,看是否重复
|
||||
List<BmProject> projectList = bmProjectMapper.selectBmProjectByProName(bmProject);
|
||||
if (projectList.size() > 1) {
|
||||
return AjaxResult.error(HttpCodeEnum.NAME_DUPLICATE.getCode(), "工程名称或工程编码与库中重复");
|
||||
}
|
||||
if (projectList.size() == 1) {
|
||||
if (!Objects.equals(projectList.get(0).getProId(), bmProject.getProId())) {
|
||||
return AjaxResult.error(HttpCodeEnum.NAME_DUPLICATE.getCode(), "工程名称或工程编码与库中重复");
|
||||
}
|
||||
}
|
||||
//校验输入的经纬度是否合规
|
||||
if (bmProject.getLon() != null) {
|
||||
if (!bmProject.getLon().matches(MaterialConstants.LONGITUDE_PATTERN)){
|
||||
return AjaxResult.error(HttpCodeEnum.INVALID_LONGITUDE_FORMAT.getCode(), HttpCodeEnum.INVALID_LONGITUDE_FORMAT.getMsg());
|
||||
}
|
||||
}
|
||||
if (bmProject.getLat() != null) {
|
||||
if (!bmProject.getLat().matches(MaterialConstants.LATITUDE_PATTERN)){
|
||||
return AjaxResult.error(HttpCodeEnum.INVALID_LATITUDE_FORMAT.getCode(), HttpCodeEnum.INVALID_LATITUDE_FORMAT.getMsg());
|
||||
}
|
||||
}
|
||||
//判断手机号是否合法
|
||||
if (StringUtils.isNotBlank(bmProject.getTelphone()) && !PhoneUtil.isMobile(bmProject.getTelphone())) {
|
||||
return AjaxResult.error(HttpCodeEnum.INVALID_PHONE_FORMAT.getCode(), HttpCodeEnum.INVALID_PHONE_FORMAT.getMsg());
|
||||
}
|
||||
bmProject.setUpdateTime(DateUtils.getNowDate());
|
||||
return bmProjectMapper.updateBmProject(bmProject);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除标段工程管理
|
||||
*
|
||||
* @param proIds 需要删除的标段工程管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBmProjectByProIds(Long[] proIds)
|
||||
{
|
||||
return bmProjectMapper.deleteBmProjectByProIds(proIds);
|
||||
bmProject.setUpdateBy(SecurityUtils.getUserId().toString());
|
||||
int result = bmProjectMapper.updateBmProject(bmProject);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg(), result);
|
||||
}
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -89,8 +210,12 @@ public class BmProjectServiceImpl implements IBmProjectService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBmProjectByProId(Long proId)
|
||||
public AjaxResult deleteBmProjectByProId(Long proId)
|
||||
{
|
||||
return bmProjectMapper.deleteBmProjectByProId(proId);
|
||||
int result = bmProjectMapper.deleteBmProjectByProId(proId);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg(), result);
|
||||
}
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,13 @@
|
|||
package com.bonus.material.basic.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.common.biz.domain.TreeBuild;
|
||||
import com.bonus.common.biz.domain.TreeNode;
|
||||
import com.bonus.common.biz.enums.HttpCodeEnum;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bonus.material.basic.mapper.BmUnitPersonMapper;
|
||||
|
|
@ -20,30 +26,6 @@ public class BmUnitPersonServiceImpl implements IBmUnitPersonService
|
|||
@Autowired
|
||||
private BmUnitPersonMapper bmUnitPersonMapper;
|
||||
|
||||
/**
|
||||
* 查询往来单位管理
|
||||
*
|
||||
* @param ID 往来单位管理主键
|
||||
* @return 往来单位管理
|
||||
*/
|
||||
@Override
|
||||
public BmUnitPerson selectBmUnitPersonByID(Long ID)
|
||||
{
|
||||
return bmUnitPersonMapper.selectBmUnitPersonByID(ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询往来单位管理列表
|
||||
*
|
||||
* @param bmUnitPerson 往来单位管理
|
||||
* @return 往来单位管理
|
||||
*/
|
||||
@Override
|
||||
public List<BmUnitPerson> selectBmUnitPersonList(BmUnitPerson bmUnitPerson)
|
||||
{
|
||||
return bmUnitPersonMapper.selectBmUnitPersonList(bmUnitPerson);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增往来单位管理
|
||||
*
|
||||
|
|
@ -51,46 +33,58 @@ public class BmUnitPersonServiceImpl implements IBmUnitPersonService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertBmUnitPerson(BmUnitPerson bmUnitPerson)
|
||||
public AjaxResult insertBmUnitPerson(BmUnitPerson bmUnitPerson)
|
||||
{
|
||||
bmUnitPerson.setCreateTime(DateUtils.getNowDate());
|
||||
return bmUnitPersonMapper.insertBmUnitPerson(bmUnitPerson);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改往来单位管理
|
||||
*
|
||||
* @param bmUnitPerson 往来单位管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateBmUnitPerson(BmUnitPerson bmUnitPerson)
|
||||
{
|
||||
bmUnitPerson.setUpdateTime(DateUtils.getNowDate());
|
||||
return bmUnitPersonMapper.updateBmUnitPerson(bmUnitPerson);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除往来单位管理
|
||||
*
|
||||
* @param IDs 需要删除的往来单位管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBmUnitPersonByIDs(Long[] IDs)
|
||||
{
|
||||
return bmUnitPersonMapper.deleteBmUnitPersonByIDs(IDs);
|
||||
int result = 0;
|
||||
if (CollectionUtils.isNotEmpty(bmUnitPerson.getUnitIdList())) {
|
||||
for (Long unitId : bmUnitPerson.getUnitIdList()) {
|
||||
bmUnitPerson.setCreateTime(DateUtils.getNowDate());
|
||||
bmUnitPerson.setUnitId(unitId);
|
||||
result += bmUnitPersonMapper.insertBmUnitPerson(bmUnitPerson);
|
||||
}
|
||||
}
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg(), result);
|
||||
}
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除往来单位管理信息
|
||||
*
|
||||
* @param ID 往来单位管理主键
|
||||
* @param unitId 往来单位管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBmUnitPersonByID(Long ID)
|
||||
public AjaxResult deleteBmUnitPersonByID(Long unitId)
|
||||
{
|
||||
return bmUnitPersonMapper.deleteBmUnitPersonByID(ID);
|
||||
int result = bmUnitPersonMapper.deleteBmUnitPersonByID(unitId);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg(), result);
|
||||
}
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询部门下拉树结构
|
||||
* @param unitPerson
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult selectDeptTree(BmUnitPerson unitPerson) {
|
||||
List<TreeNode> groupList = new ArrayList<>();
|
||||
List<TreeNode> list = new ArrayList<>();
|
||||
try {
|
||||
list = bmUnitPersonMapper.selectDeptTree(unitPerson);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
// 创建树形结构(数据集合作为参数)
|
||||
TreeBuild treeBuild = new TreeBuild(list);
|
||||
// 原查询结果转换树形结构
|
||||
groupList = treeBuild.buildTree();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return AjaxResult.success(groupList);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,15 @@
|
|||
package com.bonus.material.basic.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import cn.hutool.core.util.PhoneUtil;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.common.biz.enums.HttpCodeEnum;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bonus.material.basic.mapper.BmUnitMapper;
|
||||
|
|
@ -41,7 +49,16 @@ public class BmUnitServiceImpl implements IBmUnitService
|
|||
@Override
|
||||
public List<BmUnit> selectBmUnitList(BmUnit bmUnit)
|
||||
{
|
||||
return bmUnitMapper.selectBmUnitList(bmUnit);
|
||||
List<BmUnit> bmUnitList = bmUnitMapper.selectBmUnitList(bmUnit);
|
||||
if (CollectionUtils.isNotEmpty(bmUnitList)) {
|
||||
for (BmUnit unit : bmUnitList) {
|
||||
if (unit.getUnitId() != null) {
|
||||
//根据单位id去人员绑定中查询是否绑定,赋值绑定状态
|
||||
unit.setIsBind(bmUnitMapper.selectBmUnitPersonByUnitId(unit.getUnitId()) > 0 ? 1 : 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
return bmUnitList;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -51,10 +68,24 @@ public class BmUnitServiceImpl implements IBmUnitService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertBmUnit(BmUnit bmUnit)
|
||||
public AjaxResult insertBmUnit(BmUnit bmUnit)
|
||||
{
|
||||
//根据单位名称查询去重
|
||||
BmUnit unit = bmUnitMapper.selectBmUnitByProName(bmUnit.getUnitName());
|
||||
if (unit != null) {
|
||||
return AjaxResult.error(HttpCodeEnum.NAME_DUPLICATE.getCode(), HttpCodeEnum.NAME_DUPLICATE.getMsg());
|
||||
}
|
||||
//判断手机号是否合法
|
||||
if (StringUtils.isNotBlank(bmUnit.getTelphone()) && !PhoneUtil.isMobile(bmUnit.getTelphone())) {
|
||||
return AjaxResult.error(HttpCodeEnum.INVALID_PHONE_FORMAT.getCode(), HttpCodeEnum.INVALID_PHONE_FORMAT.getMsg());
|
||||
}
|
||||
bmUnit.setCreateTime(DateUtils.getNowDate());
|
||||
return bmUnitMapper.insertBmUnit(bmUnit);
|
||||
bmUnit.setCreateBy(SecurityUtils.getUserId().toString());
|
||||
int result = bmUnitMapper.insertBmUnit(bmUnit);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg(), result);
|
||||
}
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -64,10 +95,26 @@ public class BmUnitServiceImpl implements IBmUnitService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateBmUnit(BmUnit bmUnit)
|
||||
public AjaxResult updateBmUnit(BmUnit bmUnit)
|
||||
{
|
||||
//根据单位名称查询去重
|
||||
BmUnit unit = bmUnitMapper.selectBmUnitByProName(bmUnit.getUnitName());
|
||||
if (unit != null) {
|
||||
if (!Objects.equals(unit.getUnitId(), bmUnit.getUnitId())) {
|
||||
return AjaxResult.error(HttpCodeEnum.NAME_DUPLICATE.getCode(), HttpCodeEnum.NAME_DUPLICATE.getMsg());
|
||||
}
|
||||
}
|
||||
//判断手机号是否合法
|
||||
if (StringUtils.isNotBlank(bmUnit.getTelphone()) && !PhoneUtil.isMobile(bmUnit.getTelphone())) {
|
||||
return AjaxResult.error(HttpCodeEnum.INVALID_PHONE_FORMAT.getCode(), HttpCodeEnum.INVALID_PHONE_FORMAT.getMsg());
|
||||
}
|
||||
bmUnit.setUpdateTime(DateUtils.getNowDate());
|
||||
return bmUnitMapper.updateBmUnit(bmUnit);
|
||||
bmUnit.setUpdateBy(SecurityUtils.getUserId().toString());
|
||||
int result = bmUnitMapper.updateBmUnit(bmUnit);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg(), result);
|
||||
}
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -77,9 +124,13 @@ public class BmUnitServiceImpl implements IBmUnitService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBmUnitByUnitIds(Long[] unitIds)
|
||||
public AjaxResult deleteBmUnitByUnitIds(Long[] unitIds)
|
||||
{
|
||||
return bmUnitMapper.deleteBmUnitByUnitIds(unitIds);
|
||||
int result = bmUnitMapper.deleteBmUnitByUnitIds(unitIds);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg(), result);
|
||||
}
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -89,8 +140,12 @@ public class BmUnitServiceImpl implements IBmUnitService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBmUnitByUnitId(Long unitId)
|
||||
public AjaxResult deleteBmUnitByUnitId(Long unitId)
|
||||
{
|
||||
return bmUnitMapper.deleteBmUnitByUnitId(unitId);
|
||||
int result = bmUnitMapper.deleteBmUnitByUnitId(unitId);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg(), result);
|
||||
}
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,117 @@
|
|||
package com.bonus.material.common.utils;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* http请求方法集
|
||||
* @Author ma_sh
|
||||
* @create 2024/10/15 16:05
|
||||
*/
|
||||
public class HttpClient {
|
||||
|
||||
/**
|
||||
* 向指定URL发送GET方法的请求
|
||||
*
|
||||
* @param url
|
||||
* 发送请求的URL
|
||||
* @return URL 所代表远程资源的响应结果
|
||||
*/
|
||||
public static String sendGet(String url, String token) {
|
||||
String result = "";
|
||||
BufferedReader in = null;
|
||||
try {
|
||||
String urlNameString = url + "?whetherToPaginate=" + 0;
|
||||
URL realUrl = new URL(urlNameString);
|
||||
// 打开和URL之间的连接
|
||||
URLConnection connection = realUrl.openConnection();
|
||||
// 设置通用的请求属性
|
||||
connection.setRequestProperty("accept", "*/*");
|
||||
connection.setRequestProperty("connection", "Keep-Alive");
|
||||
connection.setRequestProperty("user-agent",
|
||||
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
|
||||
connection.setRequestProperty("Authorization", token);
|
||||
// 建立实际的连接
|
||||
connection.connect();
|
||||
// 获取所有响应头字段
|
||||
Map<String, List<String>> map = connection.getHeaderFields();
|
||||
// 遍历所有的响应头字段
|
||||
for (String key : map.keySet()) {
|
||||
System.out.println(key + "--->" + map.get(key));
|
||||
}
|
||||
// 定义 BufferedReader输入流来读取URL的响应
|
||||
in = new BufferedReader(new InputStreamReader(
|
||||
connection.getInputStream(),"UTF-8"));
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
result += line;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("发送GET请求出现异常!" + e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 使用finally块来关闭输入流
|
||||
finally {
|
||||
try {
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String sendGetInfo(String httpUrl, String appId, String ticket) {
|
||||
String result = "";
|
||||
BufferedReader in = null;
|
||||
try {
|
||||
String urlNameString = httpUrl ;
|
||||
URL realUrl = new URL(urlNameString);
|
||||
// 打开和URL之间的连接
|
||||
URLConnection connection = realUrl.openConnection();
|
||||
// 设置通用的请求属性
|
||||
connection.setRequestProperty("accept", "*/*");
|
||||
connection.setRequestProperty("connection", "Keep-Alive");
|
||||
connection.setRequestProperty("user-agent",
|
||||
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
|
||||
connection.setRequestProperty("charsert", "utf-8");
|
||||
connection.setRequestProperty("ticket", ticket);
|
||||
connection.setRequestProperty("appId", appId);
|
||||
// 建立实际的连接
|
||||
connection.connect();
|
||||
// 获取所有响应头字段
|
||||
Map<String, List<String>> map = connection.getHeaderFields();
|
||||
// 遍历所有的响应头字段
|
||||
for (String key : map.keySet()) {
|
||||
System.out.println(key + "--->" + map.get(key));
|
||||
}
|
||||
// 定义 BufferedReader输入流来读取URL的响应
|
||||
in = new BufferedReader(new InputStreamReader(
|
||||
connection.getInputStream()));
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
result += line;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("发送GET请求出现异常!" + e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 使用finally块来关闭输入流
|
||||
finally {
|
||||
try {
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
@ -4,6 +4,8 @@ import java.util.List;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||
import com.bonus.material.ma.domain.Type;
|
||||
import com.bonus.material.ma.vo.MachineVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -47,10 +49,21 @@ public class MachineController extends BaseController {
|
|||
public TableDataInfo list(Machine machine)
|
||||
{
|
||||
startPage();
|
||||
List<Machine> list = machineService.selectMachineList(machine);
|
||||
List<MachineVo> list = machineService.selectMachineList(machine);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询机具设备管理列表
|
||||
*/
|
||||
@ApiOperation(value = "查询机具设备管理列表")
|
||||
@RequiresPermissions("ma:machine:typeList")
|
||||
@GetMapping("/getTypeList")
|
||||
public AjaxResult list(Type type)
|
||||
{
|
||||
return machineService.selectByTypeList(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出机具设备管理列表
|
||||
*/
|
||||
|
|
@ -61,8 +74,8 @@ public class MachineController extends BaseController {
|
|||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Machine machine)
|
||||
{
|
||||
List<Machine> list = machineService.selectMachineList(machine);
|
||||
ExcelUtil<Machine> util = new ExcelUtil<Machine>(Machine.class);
|
||||
List<MachineVo> list = machineService.selectMachineList(machine);
|
||||
ExcelUtil<MachineVo> util = new ExcelUtil<MachineVo>(MachineVo.class);
|
||||
util.exportExcel(response, list, "机具设备管理数据");
|
||||
}
|
||||
|
||||
|
|
@ -74,7 +87,7 @@ public class MachineController extends BaseController {
|
|||
@GetMapping(value = "/{maId}")
|
||||
public AjaxResult getInfo(@PathVariable("maId") Long maId)
|
||||
{
|
||||
return success(machineService.selectMachineByMaId(maId));
|
||||
return AjaxResult.success(machineService.selectMachineByMaId(maId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -100,7 +113,7 @@ public class MachineController extends BaseController {
|
|||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Machine machine)
|
||||
{
|
||||
return toAjax(machineService.updateMachine(machine));
|
||||
return machineService.updateMachine(machine);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -110,9 +123,9 @@ public class MachineController extends BaseController {
|
|||
@PreventRepeatSubmit
|
||||
@RequiresPermissions("ma:machine:remove")
|
||||
@SysLog(title = "机具设备管理", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除机具设备管理")
|
||||
@DeleteMapping("/{maIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] maIds)
|
||||
@DeleteMapping("/{maId}")
|
||||
public AjaxResult remove(@PathVariable Long maId)
|
||||
{
|
||||
return toAjax(machineService.deleteMachineByMaIds(maIds));
|
||||
return machineService.deleteMachineByMaId(maId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import com.bonus.material.ma.service.IPartTypeService;
|
|||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 配件类型管理Controller
|
||||
|
|
@ -44,11 +43,16 @@ public class PartTypeController extends BaseController
|
|||
@ApiOperation(value = "查询配件类型管理列表")
|
||||
@RequiresPermissions("ma:type:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(PartType partType)
|
||||
public AjaxResult list(PartType partType)
|
||||
{
|
||||
startPage();
|
||||
List<PartType> list = partTypeService.selectPartTypeList(partType);
|
||||
return getDataTable(list);
|
||||
return partTypeService.selectPartTypeList(partType);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "配件类型所属上级树")
|
||||
@RequiresPermissions("ma:type:query")
|
||||
@GetMapping("/getPartTree")
|
||||
public AjaxResult getPartTree(PartType dto){
|
||||
return partTypeService.getPartTree(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -61,7 +65,7 @@ public class PartTypeController extends BaseController
|
|||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, PartType partType)
|
||||
{
|
||||
List<PartType> list = partTypeService.selectPartTypeList(partType);
|
||||
List<PartType> list = partTypeService.getTypeList(partType);
|
||||
ExcelUtil<PartType> util = new ExcelUtil<PartType>(PartType.class);
|
||||
util.exportExcel(response, list, "配件类型管理数据");
|
||||
}
|
||||
|
|
@ -71,10 +75,10 @@ public class PartTypeController extends BaseController
|
|||
*/
|
||||
@ApiOperation(value = "获取配件类型管理详细信息")
|
||||
@RequiresPermissions("ma:type:query")
|
||||
@GetMapping(value = "/{paId}")
|
||||
public AjaxResult getInfo(@PathVariable("paId") Long paId)
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(partTypeService.selectPartTypeByPaId(paId));
|
||||
return AjaxResult.success(partTypeService.selectPartTypeByPaId(id));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -87,7 +91,7 @@ public class PartTypeController extends BaseController
|
|||
@PostMapping
|
||||
public AjaxResult add(@RequestBody PartType partType)
|
||||
{
|
||||
return toAjax(partTypeService.insertPartType(partType));
|
||||
return partTypeService.insertPartType(partType);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -100,7 +104,7 @@ public class PartTypeController extends BaseController
|
|||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody PartType partType)
|
||||
{
|
||||
return toAjax(partTypeService.updatePartType(partType));
|
||||
return partTypeService.updatePartType(partType);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -110,9 +114,9 @@ public class PartTypeController extends BaseController
|
|||
@PreventRepeatSubmit
|
||||
@RequiresPermissions("ma:type:remove")
|
||||
@SysLog(title = "配件类型管理", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除配件类型管理")
|
||||
@DeleteMapping("/{paIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] paIds)
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult remove(@PathVariable Long id)
|
||||
{
|
||||
return toAjax(partTypeService.deletePartTypeByPaIds(paIds));
|
||||
return partTypeService.deletePartTypeByPaId(id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,12 +4,11 @@ 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.biz.domain.TreeSelect;
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -148,5 +148,19 @@ public class Machine extends BaseEntity
|
|||
@ApiModelProperty(value = "联系电话")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty(value = "关键字")
|
||||
private String keyWord;
|
||||
|
||||
@ApiModelProperty(value = "是否是固定资产 0 是,1 否")
|
||||
private Integer isAssets;
|
||||
|
||||
@ApiModelProperty("物品种类-二级")
|
||||
private String materialType;
|
||||
|
||||
@ApiModelProperty("设备类型-三级")
|
||||
private String materialName;
|
||||
|
||||
@ApiModelProperty("规格型号-四级")
|
||||
private String materialModel;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,24 +13,23 @@ import com.bonus.common.core.web.domain.BaseEntity;
|
|||
* @author xsheng
|
||||
* @date 2024-09-27
|
||||
*/
|
||||
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
public class PartType extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer isExport;
|
||||
|
||||
/** 类型ID */
|
||||
private Long paId;
|
||||
private Long id;
|
||||
|
||||
/** 类型名称 */
|
||||
@Excel(name = "类型名称")
|
||||
@Excel(name = "名称")
|
||||
@ApiModelProperty(value = "类型名称")
|
||||
private String paName;
|
||||
|
||||
/** 上级ID */
|
||||
@Excel(name = "上级ID")
|
||||
@ApiModelProperty(value = "上级ID")
|
||||
private Long parentId;
|
||||
|
||||
|
|
@ -38,28 +37,30 @@ public class PartType extends BaseEntity
|
|||
@Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
|
||||
private String status;
|
||||
|
||||
/** 实时库存 */
|
||||
@Excel(name = "实时库存")
|
||||
@ApiModelProperty(value = "实时库存")
|
||||
private Long storageNum;
|
||||
|
||||
/** 计量单位ID */
|
||||
@Excel(name = "计量单位ID")
|
||||
@ApiModelProperty(value = "计量单位ID")
|
||||
private String unitId;
|
||||
|
||||
/** 计量单位名称 */
|
||||
@Excel(name = "计量单位")
|
||||
@ApiModelProperty(value = "计量单位名称")
|
||||
private String unitName;
|
||||
|
||||
/** 原值 */
|
||||
@Excel(name = "原值")
|
||||
@Excel(name = "购置价格(元)")
|
||||
@ApiModelProperty(value = "原值")
|
||||
private BigDecimal buyPrice;
|
||||
|
||||
/** 实时库存 */
|
||||
@Excel(name = "数量")
|
||||
@ApiModelProperty(value = "实时库存")
|
||||
private Long storageNum;
|
||||
|
||||
/** 层级 */
|
||||
@Excel(name = "层级")
|
||||
@ApiModelProperty(value = "层级")
|
||||
private String level;
|
||||
|
||||
/** 库存预警数量 */
|
||||
@Excel(name = "库存预警数量")
|
||||
@ApiModelProperty(value = "库存预警数量")
|
||||
private Long warnNum;
|
||||
|
||||
|
|
@ -67,14 +68,17 @@ public class PartType extends BaseEntity
|
|||
private String delFlag;
|
||||
|
||||
/** 数据所属组织 */
|
||||
@Excel(name = "数据所属组织")
|
||||
@ApiModelProperty(value = "数据所属组织")
|
||||
private String companyId;
|
||||
|
||||
/** 框架年份 */
|
||||
@Excel(name = "框架年份")
|
||||
@ApiModelProperty(value = "框架年份")
|
||||
private String year;
|
||||
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(value = "关键字")
|
||||
private String keyWord;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,11 @@
|
|||
package com.bonus.material.ma.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.ma.domain.Machine;
|
||||
import com.bonus.material.ma.domain.Type;
|
||||
import com.bonus.material.ma.vo.MachineVo;
|
||||
|
||||
/**
|
||||
* 机具设备管理Mapper接口
|
||||
|
|
@ -17,7 +21,7 @@ public interface MachineMapper
|
|||
* @param maId 机具设备管理主键
|
||||
* @return 机具设备管理
|
||||
*/
|
||||
public Machine selectMachineByMaId(Long maId);
|
||||
public MachineVo selectMachineByMaId(Long maId);
|
||||
|
||||
/**
|
||||
* 查询机具设备管理列表
|
||||
|
|
@ -25,7 +29,7 @@ public interface MachineMapper
|
|||
* @param machine 机具设备管理
|
||||
* @return 机具设备管理集合
|
||||
*/
|
||||
public List<Machine> selectMachineList(Machine machine);
|
||||
public List<MachineVo> selectMachineList(Machine machine);
|
||||
|
||||
/**
|
||||
* 新增机具设备管理
|
||||
|
|
@ -58,4 +62,11 @@ public interface MachineMapper
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteMachineByMaIds(Long[] maIds);
|
||||
|
||||
/**
|
||||
* 查询机具设备管理列表
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
List<Type> selectByTypeList(Type type);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.bonus.material.ma.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.bonus.common.biz.domain.TreeNode;
|
||||
import com.bonus.material.ma.domain.PartType;
|
||||
|
||||
/**
|
||||
|
|
@ -14,10 +16,10 @@ public interface PartTypeMapper
|
|||
/**
|
||||
* 查询配件类型管理
|
||||
*
|
||||
* @param paId 配件类型管理主键
|
||||
* @param id 配件类型管理主键
|
||||
* @return 配件类型管理
|
||||
*/
|
||||
public PartType selectPartTypeByPaId(Long paId);
|
||||
public PartType selectPartTypeByPaId(Long id);
|
||||
|
||||
/**
|
||||
* 查询配件类型管理列表
|
||||
|
|
@ -25,7 +27,7 @@ public interface PartTypeMapper
|
|||
* @param partType 配件类型管理
|
||||
* @return 配件类型管理集合
|
||||
*/
|
||||
public List<PartType> selectPartTypeList(PartType partType);
|
||||
public List<TreeNode> selectPartTypeList(PartType partType);
|
||||
|
||||
/**
|
||||
* 新增配件类型管理
|
||||
|
|
@ -46,16 +48,43 @@ public interface PartTypeMapper
|
|||
/**
|
||||
* 删除配件类型管理
|
||||
*
|
||||
* @param paId 配件类型管理主键
|
||||
* @param id 配件类型管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePartTypeByPaId(Long paId);
|
||||
public int deletePartTypeByPaId(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除配件类型管理
|
||||
*
|
||||
* @param paIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
* 获取配件类型树
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
public int deletePartTypeByPaIds(Long[] paIds);
|
||||
List<TreeNode> getPartTree(PartType dto);
|
||||
|
||||
/**
|
||||
* 获取配件类型列表
|
||||
* @param partType
|
||||
* @return
|
||||
*/
|
||||
List<PartType> getTypeList(PartType partType);
|
||||
|
||||
/**
|
||||
* 根据名称查询
|
||||
* @param partType
|
||||
* @return
|
||||
*/
|
||||
PartType selectByName(PartType partType);
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int selectById(Long id);
|
||||
|
||||
/**
|
||||
* 查询配件是否在用
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int selectPart(Long id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,11 @@
|
|||
package com.bonus.material.ma.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.ma.domain.Machine;
|
||||
import com.bonus.material.ma.domain.Type;
|
||||
import com.bonus.material.ma.vo.MachineVo;
|
||||
|
||||
/**
|
||||
* 机具设备管理Service接口
|
||||
|
|
@ -17,7 +21,7 @@ public interface IMachineService
|
|||
* @param maId 机具设备管理主键
|
||||
* @return 机具设备管理
|
||||
*/
|
||||
public Machine selectMachineByMaId(Long maId);
|
||||
public MachineVo selectMachineByMaId(Long maId);
|
||||
|
||||
/**
|
||||
* 查询机具设备管理列表
|
||||
|
|
@ -25,7 +29,7 @@ public interface IMachineService
|
|||
* @param machine 机具设备管理
|
||||
* @return 机具设备管理集合
|
||||
*/
|
||||
public List<Machine> selectMachineList(Machine machine);
|
||||
public List<MachineVo> selectMachineList(Machine machine);
|
||||
|
||||
/**
|
||||
* 新增机具设备管理
|
||||
|
|
@ -41,7 +45,7 @@ public interface IMachineService
|
|||
* @param machine 机具设备管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMachine(Machine machine);
|
||||
public AjaxResult updateMachine(Machine machine);
|
||||
|
||||
/**
|
||||
* 批量删除机具设备管理
|
||||
|
|
@ -57,5 +61,12 @@ public interface IMachineService
|
|||
* @param maId 机具设备管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMachineByMaId(Long maId);
|
||||
public AjaxResult deleteMachineByMaId(Long maId);
|
||||
|
||||
/**
|
||||
* 根据类型查询机具设备管理列表
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
AjaxResult selectByTypeList(Type type);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.bonus.material.ma.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.ma.domain.PartType;
|
||||
|
||||
/**
|
||||
|
|
@ -14,10 +16,10 @@ public interface IPartTypeService
|
|||
/**
|
||||
* 查询配件类型管理
|
||||
*
|
||||
* @param paId 配件类型管理主键
|
||||
* @param id 配件类型管理主键
|
||||
* @return 配件类型管理
|
||||
*/
|
||||
public PartType selectPartTypeByPaId(Long paId);
|
||||
public PartType selectPartTypeByPaId(Long id);
|
||||
|
||||
/**
|
||||
* 查询配件类型管理列表
|
||||
|
|
@ -25,7 +27,7 @@ public interface IPartTypeService
|
|||
* @param partType 配件类型管理
|
||||
* @return 配件类型管理集合
|
||||
*/
|
||||
public List<PartType> selectPartTypeList(PartType partType);
|
||||
public AjaxResult selectPartTypeList(PartType partType);
|
||||
|
||||
/**
|
||||
* 新增配件类型管理
|
||||
|
|
@ -33,7 +35,7 @@ public interface IPartTypeService
|
|||
* @param partType 配件类型管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertPartType(PartType partType);
|
||||
public AjaxResult insertPartType(PartType partType);
|
||||
|
||||
/**
|
||||
* 修改配件类型管理
|
||||
|
|
@ -41,21 +43,27 @@ public interface IPartTypeService
|
|||
* @param partType 配件类型管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updatePartType(PartType partType);
|
||||
|
||||
/**
|
||||
* 批量删除配件类型管理
|
||||
*
|
||||
* @param paIds 需要删除的配件类型管理主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePartTypeByPaIds(Long[] paIds);
|
||||
public AjaxResult updatePartType(PartType partType);
|
||||
|
||||
/**
|
||||
* 删除配件类型管理信息
|
||||
*
|
||||
* @param paId 配件类型管理主键
|
||||
* @param id 配件类型管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePartTypeByPaId(Long paId);
|
||||
public AjaxResult deletePartTypeByPaId(Long id);
|
||||
|
||||
/**
|
||||
* 获取配件类型树
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
AjaxResult getPartTree(PartType dto);
|
||||
|
||||
/**
|
||||
* 导出结果集
|
||||
* @param partType
|
||||
* @return
|
||||
*/
|
||||
List<PartType> getTypeList(PartType partType);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,25 @@
|
|||
package com.bonus.material.ma.service.impl;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.bonus.common.biz.enums.HttpCodeEnum;
|
||||
import com.bonus.common.core.constant.SecurityConstants;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.ma.domain.Type;
|
||||
import com.bonus.material.ma.vo.MachineVo;
|
||||
import com.bonus.system.api.RemoteUserService;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bonus.material.ma.mapper.MachineMapper;
|
||||
import com.bonus.material.ma.domain.Machine;
|
||||
import com.bonus.material.ma.service.IMachineService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 机具设备管理Service业务层处理
|
||||
*
|
||||
|
|
@ -17,9 +29,12 @@ import com.bonus.material.ma.service.IMachineService;
|
|||
@Service
|
||||
public class MachineServiceImpl implements IMachineService
|
||||
{
|
||||
@Autowired
|
||||
@Resource
|
||||
private MachineMapper machineMapper;
|
||||
|
||||
@Resource
|
||||
private RemoteUserService remoteUserService;
|
||||
|
||||
/**
|
||||
* 查询机具设备管理
|
||||
*
|
||||
|
|
@ -27,9 +42,27 @@ public class MachineServiceImpl implements IMachineService
|
|||
* @return 机具设备管理
|
||||
*/
|
||||
@Override
|
||||
public Machine selectMachineByMaId(Long maId)
|
||||
public MachineVo selectMachineByMaId(Long maId)
|
||||
{
|
||||
return machineMapper.selectMachineByMaId(maId);
|
||||
MachineVo machineVo = machineMapper.selectMachineByMaId(maId);
|
||||
AjaxResult ajaxResult = remoteUserService.getInfo(machineVo.getKeeperId(), SecurityConstants.INNER);
|
||||
// ajaxResult.get("data") 返回的是 LinkedHashMap
|
||||
LinkedHashMap rawDataList = (LinkedHashMap) ajaxResult.get("data");
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
if (rawDataList != null) {
|
||||
SysUser sysUser = objectMapper.convertValue(rawDataList, SysUser.class);
|
||||
machineVo.setKeeperName(sysUser.getNickName() == null ? "" : sysUser.getNickName());
|
||||
}
|
||||
AjaxResult info = remoteUserService.getInfo(machineVo.getRepairId(), SecurityConstants.INNER);
|
||||
// ajaxResult.get("data") 返回的是 LinkedHashMap
|
||||
LinkedHashMap dataList = (LinkedHashMap) info.get("data");
|
||||
if (dataList != null) {
|
||||
SysUser sysUser = objectMapper.convertValue(dataList, SysUser.class);
|
||||
machineVo.setRepairName(sysUser.getNickName() == null ? "" : sysUser.getNickName());
|
||||
}
|
||||
|
||||
return machineVo;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -39,7 +72,7 @@ public class MachineServiceImpl implements IMachineService
|
|||
* @return 机具设备管理
|
||||
*/
|
||||
@Override
|
||||
public List<Machine> selectMachineList(Machine machine)
|
||||
public List<MachineVo> selectMachineList(Machine machine)
|
||||
{
|
||||
return machineMapper.selectMachineList(machine);
|
||||
}
|
||||
|
|
@ -64,10 +97,14 @@ public class MachineServiceImpl implements IMachineService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateMachine(Machine machine)
|
||||
public AjaxResult updateMachine(Machine machine)
|
||||
{
|
||||
machine.setUpdateTime(DateUtils.getNowDate());
|
||||
return machineMapper.updateMachine(machine);
|
||||
int result = machineMapper.updateMachine(machine);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg(), result);
|
||||
}
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -89,8 +126,23 @@ public class MachineServiceImpl implements IMachineService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMachineByMaId(Long maId)
|
||||
public AjaxResult deleteMachineByMaId(Long maId)
|
||||
{
|
||||
return machineMapper.deleteMachineByMaId(maId);
|
||||
int result = machineMapper.deleteMachineByMaId(maId);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg(), result);
|
||||
}
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据类型查询
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult selectByTypeList(Type type) {
|
||||
List<Type> typeList = machineMapper.selectByTypeList(type);
|
||||
return AjaxResult.success(typeList);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,17 @@
|
|||
package com.bonus.material.ma.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.bonus.common.biz.domain.TreeBuild;
|
||||
import com.bonus.common.biz.domain.TreeNode;
|
||||
import com.bonus.common.biz.enums.HttpCodeEnum;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bonus.material.ma.mapper.PartTypeMapper;
|
||||
|
|
@ -15,6 +25,7 @@ import com.bonus.material.ma.service.IPartTypeService;
|
|||
* @date 2024-09-27
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class PartTypeServiceImpl implements IPartTypeService
|
||||
{
|
||||
@Autowired
|
||||
|
|
@ -23,13 +34,13 @@ public class PartTypeServiceImpl implements IPartTypeService
|
|||
/**
|
||||
* 查询配件类型管理
|
||||
*
|
||||
* @param paId 配件类型管理主键
|
||||
* @param id 配件类型管理主键
|
||||
* @return 配件类型管理
|
||||
*/
|
||||
@Override
|
||||
public PartType selectPartTypeByPaId(Long paId)
|
||||
public PartType selectPartTypeByPaId(Long id)
|
||||
{
|
||||
return partTypeMapper.selectPartTypeByPaId(paId);
|
||||
return partTypeMapper.selectPartTypeByPaId(id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -39,9 +50,22 @@ public class PartTypeServiceImpl implements IPartTypeService
|
|||
* @return 配件类型管理
|
||||
*/
|
||||
@Override
|
||||
public List<PartType> selectPartTypeList(PartType partType)
|
||||
public AjaxResult selectPartTypeList(PartType partType)
|
||||
{
|
||||
return partTypeMapper.selectPartTypeList(partType);
|
||||
List<TreeNode> groupList = new ArrayList<>();
|
||||
List<TreeNode> list = new ArrayList<>();
|
||||
try {
|
||||
list = partTypeMapper.selectPartTypeList(partType);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
// 创建树形结构(数据集合作为参数)
|
||||
TreeBuild treeBuild = new TreeBuild(list);
|
||||
// 原查询结果转换树形结构
|
||||
groupList = treeBuild.buildTree();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("配件类型树-查询失败", e);
|
||||
}
|
||||
return AjaxResult.success(groupList);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -51,10 +75,25 @@ public class PartTypeServiceImpl implements IPartTypeService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertPartType(PartType partType)
|
||||
public AjaxResult insertPartType(PartType partType)
|
||||
{
|
||||
if (partType == null || partType.getPaName() == null) {
|
||||
return AjaxResult.error(HttpCodeEnum.TO_PARAM_NULL.getCode(), HttpCodeEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
//新增判重,二级和三级不同类型下面可以重复,一级不能重复
|
||||
PartType type = partTypeMapper.selectByName(partType);
|
||||
if (type != null) {
|
||||
return AjaxResult.error(HttpCodeEnum.NAME_DUPLICATE.getCode(), HttpCodeEnum.NAME_DUPLICATE.getMsg());
|
||||
}
|
||||
partType.setCreateTime(DateUtils.getNowDate());
|
||||
return partTypeMapper.insertPartType(partType);
|
||||
partType.setCreateBy(SecurityUtils.getUserId().toString());
|
||||
partType.setParentId(partType.getId() != 0 ? partType.getId() : 0L);
|
||||
partType.setLevel(partType.getLevel() != null ? String.valueOf(Integer.valueOf(partType.getLevel()) + 1) : "1");
|
||||
int result = partTypeMapper.insertPartType(partType);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg(), result);
|
||||
}
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -64,33 +103,84 @@ public class PartTypeServiceImpl implements IPartTypeService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updatePartType(PartType partType)
|
||||
public AjaxResult updatePartType(PartType partType)
|
||||
{
|
||||
if (partType == null || partType.getPaName() == null || partType.getParentId() == null || partType.getId() == null) {
|
||||
return AjaxResult.error(HttpCodeEnum.TO_PARAM_NULL.getCode(), HttpCodeEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
//修改判重,二级和三级不同类型下面可以重复,一级不能重复
|
||||
PartType type = partTypeMapper.selectByName(partType);
|
||||
if (type != null) {
|
||||
if (!Objects.equals(type.getId(), partType.getId())) {
|
||||
return AjaxResult.error(HttpCodeEnum.NAME_DUPLICATE.getCode(), HttpCodeEnum.NAME_DUPLICATE.getMsg());
|
||||
}
|
||||
}
|
||||
partType.setUpdateTime(DateUtils.getNowDate());
|
||||
return partTypeMapper.updatePartType(partType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除配件类型管理
|
||||
*
|
||||
* @param paIds 需要删除的配件类型管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePartTypeByPaIds(Long[] paIds)
|
||||
{
|
||||
return partTypeMapper.deletePartTypeByPaIds(paIds);
|
||||
partType.setUpdateBy(SecurityUtils.getUserId().toString());
|
||||
int result = partTypeMapper.updatePartType(partType);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg(), result);
|
||||
}
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除配件类型管理信息
|
||||
*
|
||||
* @param paId 配件类型管理主键
|
||||
* @param id 配件类型管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePartTypeByPaId(Long paId)
|
||||
public AjaxResult deletePartTypeByPaId(Long id)
|
||||
{
|
||||
return partTypeMapper.deletePartTypeByPaId(paId);
|
||||
//判断配件类型下是否有下级配件
|
||||
int count = partTypeMapper.selectById(id);
|
||||
if (count > 0) {
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "该类型下有下级配件,不允许删除");
|
||||
}
|
||||
//判断配件是否在用,在用则不能删除
|
||||
int i = partTypeMapper.selectPart(id);
|
||||
if (i > 0) {
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "该配件类型处于在用状态,不允许删除");
|
||||
}
|
||||
int result = partTypeMapper.deletePartTypeByPaId(id);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg(), result);
|
||||
}
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配件类型树
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult getPartTree(PartType dto) {
|
||||
List<TreeNode> groupList = new ArrayList<>();
|
||||
List<TreeNode> list = new ArrayList<>();
|
||||
try {
|
||||
list = partTypeMapper.getPartTree(dto);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
// 创建树形结构(数据集合作为参数)
|
||||
TreeBuild treeBuild = new TreeBuild(list);
|
||||
// 原查询结果转换树形结构
|
||||
groupList = treeBuild.buildTree();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("配件所属上级树-查询失败", e);
|
||||
}
|
||||
return AjaxResult.success(groupList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配件类型列表
|
||||
* @param partType
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<PartType> getTypeList(PartType partType) {
|
||||
return partTypeMapper.getTypeList(partType);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
package com.bonus.material.ma.vo;
|
||||
|
||||
import com.bonus.material.ma.domain.Machine;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 设备返回vo
|
||||
* @Author ma_sh
|
||||
* @create 2024/10/17 13:25
|
||||
*/
|
||||
@Data
|
||||
public class MachineVo extends Machine {
|
||||
|
||||
@ApiModelProperty("物品类型-一级")
|
||||
private String itemType;
|
||||
|
||||
@ApiModelProperty("物品种类-二级")
|
||||
private String materialType;
|
||||
|
||||
@ApiModelProperty("设备类型-三级")
|
||||
private String materialName;
|
||||
|
||||
@ApiModelProperty("规格型号-四级")
|
||||
private String materialModel;
|
||||
|
||||
@ApiModelProperty("库管员id")
|
||||
private Long keeperId;
|
||||
|
||||
@ApiModelProperty("库管员名称")
|
||||
private String keeperName;
|
||||
|
||||
@ApiModelProperty("维修员id")
|
||||
private Long repairId;
|
||||
|
||||
@ApiModelProperty("维修员名称")
|
||||
private String repairName;
|
||||
|
||||
@ApiModelProperty("资产属性名称")
|
||||
private String assetName;
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
# Spring
|
||||
spring:
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: bonus-material
|
||||
|
|
|
|||
|
|
@ -0,0 +1,99 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.material.basic.mapper.BmAssetAttributesMapper">
|
||||
|
||||
<insert id="insertBmUnitType">
|
||||
insert into bm_unit_type
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="typeName != null and typeName != ''">type_name,</if>
|
||||
<if test="companyId != null">company_id,</if>
|
||||
del_flag,
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="typeName != null and typeName != ''">#{typeName},</if>
|
||||
<if test="companyId != null">#{companyId},</if>
|
||||
0,
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="insert">
|
||||
insert into bm_asset_attributes
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="assetCode != null and assetCode != ''">asset_code,</if>
|
||||
<if test="assetName != null and assetName != ''">asset_name,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
del_flag
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="assetCode != null and assetCode != ''">#{assetCode},</if>
|
||||
<if test="assetName != null and assetName != ''">#{assetName},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
0
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
update bm_asset_attributes
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="assetCode != null and assetCode != ''">asset_code = #{assetCode},</if>
|
||||
<if test="assetName != null and assetName != ''">asset_name = #{assetName},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime !=null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteById">
|
||||
update bm_asset_attributes set del_flag = 2 where id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="queryAllByLimit" resultType="com.bonus.material.basic.domain.BmAssetAttributes">
|
||||
select bma.id as id, bma.asset_code as assetCode, bma.asset_name as assetName, bma.create_by as createBy,
|
||||
bma.create_time as createTime, bma.del_flag as delFlag, bma.update_by as updateBy, bma.update_time as updateTime
|
||||
from bm_asset_attributes bma
|
||||
where bma.del_flag = '0'
|
||||
<if test="assetName != null and assetName!= ''">
|
||||
and bma.asset_name like concat('%', #{assetName}, '%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="queryById" resultType="com.bonus.material.basic.domain.BmAssetAttributes">
|
||||
select bma.id as id, bma.asset_code as assetCode, bma.asset_name as assetName, bma.create_by as createBy,
|
||||
bma.create_time as createTime, bma.del_flag as delFlag, bma.update_by as updateBy, bma.update_time as updateTime
|
||||
from bm_asset_attributes bma
|
||||
where bma.del_flag = '0' and bma.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectBmAssetAttributesByAssetCode"
|
||||
resultType="com.bonus.material.basic.domain.BmAssetAttributes">
|
||||
select bma.id as id, bma.asset_code as assetCode, bma.asset_name as assetName, bma.create_by as createBy,
|
||||
bma.create_time as createTime, bma.del_flag as delFlag, bma.update_by as updateBy, bma.update_time as updateTime
|
||||
from bm_asset_attributes bma
|
||||
where bma.del_flag = '0'
|
||||
<if test="assetName != null and assetName != ''">
|
||||
<if test="assetCode != null and assetCode != ''">
|
||||
and (bma.asset_name = #{assetName} or bma.asset_code = #{assetCode})
|
||||
</if>
|
||||
<if test="assetCode == null or assetCode == ''">
|
||||
and bma.asset_code = #{assetCode}
|
||||
</if>
|
||||
</if>
|
||||
<if test="assetName == null or assetName == ''">
|
||||
<if test="assetCode != null and assetCode != ''">
|
||||
and bma.asset_code = #{assetCode}
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -23,15 +23,48 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="proCode" column="pro_code" />
|
||||
<result property="impUnit" column="imp_unit" />
|
||||
<result property="proNature" column="pro_nature" />
|
||||
<result property="proStatus" column="pro_status" />
|
||||
<result property="contractPart" column="contract_part" />
|
||||
<result property="proCenter" column="pro_center" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBmProjectVo">
|
||||
select pro_id, pro_name, external_id, external_info, pro_type_id, lon, lat, pro_manager, telphone, plan_start_date, plan_end_date, actual_start_date, actual_end_date, create_by, create_time, update_by, update_time, remark, del_flag from bm_project
|
||||
select bp.pro_id,
|
||||
bp.pro_name,
|
||||
bp.external_id,
|
||||
bp.external_info,
|
||||
bp.pro_type_id,
|
||||
bp.lon,
|
||||
bp.lat,
|
||||
bp.pro_manager,
|
||||
bp.telphone,
|
||||
bp.plan_start_date,
|
||||
bp.plan_end_date,
|
||||
bp.actual_start_date,
|
||||
bp.actual_end_date,
|
||||
bp.create_by,
|
||||
bp.create_time,
|
||||
bp.update_by,
|
||||
bp.update_time,
|
||||
bp.remark,
|
||||
bp.del_flag,
|
||||
bp.pro_code,
|
||||
sd.dept_name as impUnit,
|
||||
bp.pro_nature,
|
||||
bp.pro_status,
|
||||
bp.contract_part,
|
||||
bp.pro_center
|
||||
from bm_project bp
|
||||
left join sys_dept sd on sd.dept_id = bp.imp_unit and sd.del_flag = 0
|
||||
</sql>
|
||||
|
||||
<select id="selectBmProjectList" parameterType="com.bonus.material.basic.domain.BmProject" resultMap="BmProjectResult">
|
||||
<include refid="selectBmProjectVo"/>
|
||||
<where>
|
||||
<where>
|
||||
bp.del_flag = 0
|
||||
<if test="proName != null and proName != ''"> and pro_name like concat('%', #{proName}, '%')</if>
|
||||
<if test="externalId != null and externalId != ''"> and external_id = #{externalId}</if>
|
||||
<if test="externalInfo != null and externalInfo != ''"> and external_info = #{externalInfo}</if>
|
||||
|
|
@ -49,9 +82,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="selectBmProjectByProId" parameterType="Long" resultMap="BmProjectResult">
|
||||
<include refid="selectBmProjectVo"/>
|
||||
where pro_id = #{proId}
|
||||
where del_flag = 0 and pro_id = #{proId}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectBmProjectByProName" resultType="com.bonus.material.basic.domain.BmProject">
|
||||
select bp.pro_id as proId,
|
||||
bp.pro_name as proName,
|
||||
bp.pro_code as proCode
|
||||
from bm_project bp
|
||||
where bp.del_flag = '0'
|
||||
<if test="proName != null and proName != ''">
|
||||
<if test="proCode != null and proCode != ''">
|
||||
and (bp.pro_name = #{proName} or bp.pro_code = #{proCode})
|
||||
</if>
|
||||
<if test="proCode == null or proCode == ''">
|
||||
and bp.pro_name = #{proName}
|
||||
</if>
|
||||
</if>
|
||||
<if test="proName == null or proName == ''">
|
||||
<if test="proCode != null and proCode != ''">
|
||||
and bp.pro_code = #{proCode}
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<insert id="insertBmProject" parameterType="com.bonus.material.basic.domain.BmProject">
|
||||
insert into bm_project
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
|
@ -73,7 +127,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
del_flag,
|
||||
<if test="proCode != null">pro_code,</if>
|
||||
<if test="impUnit != null">imp_unit,</if>
|
||||
<if test="proNature != null">pro_nature,</if>
|
||||
<if test="proStatus != null">pro_status,</if>
|
||||
<if test="contractPart != null">contract_part,</if>
|
||||
<if test="proCenter != null">pro_center</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="proId != null">#{proId},</if>
|
||||
|
|
@ -94,7 +154,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
0,
|
||||
<if test="proCode != null">#{proCode},</if>
|
||||
<if test="impUnit != null">#{impUnit},</if>
|
||||
<if test="proNature != null">#{proNature},</if>
|
||||
<if test="proStatus != null">#{proStatus},</if>
|
||||
<if test="contractPart != null">#{contractPart},</if>
|
||||
<if test="proCenter != null">#{proCenter}</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
|
@ -113,24 +179,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="planEndDate != null">plan_end_date = #{planEndDate},</if>
|
||||
<if test="actualStartDate != null">actual_start_date = #{actualStartDate},</if>
|
||||
<if test="actualEndDate != null">actual_end_date = #{actualEndDate},</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>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
<if test="proCode != null">pro_code = #{proCode},</if>
|
||||
<if test="impUnit != null">imp_unit = #{impUnit},</if>
|
||||
<if test="proNature != null">pro_nature = #{proNature},</if>
|
||||
<if test="proStatus != null">pro_status = #{proStatus},</if>
|
||||
<if test="contractPart != null">contract_part = #{contractPart},</if>
|
||||
<if test="proCenter != null">pro_center = #{proCenter}</if>
|
||||
</trim>
|
||||
where pro_id = #{proId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBmProjectByProId" parameterType="Long">
|
||||
delete from bm_project where pro_id = #{proId}
|
||||
update bm_project set del_flag = 2 where pro_id = #{proId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBmProjectByProIds" parameterType="String">
|
||||
delete from bm_project where pro_id in
|
||||
<foreach item="proId" collection="array" open="(" separator="," close=")">
|
||||
#{proId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
|
|
@ -13,7 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="outNum" column="out_num" />
|
||||
<result property="backNum" column="back_num" />
|
||||
<result property="passNum" column="pass_num" />
|
||||
<result property="maintenanceNum" column="maintenance_num" />
|
||||
<result property="repairNum" column="repair_num" />
|
||||
<result property="scrapNum" column="scrap_num" />
|
||||
<result property="postStoreNum" column="post_store_num" />
|
||||
<result property="taskId" column="task_id" />
|
||||
|
|
@ -32,7 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectBmStorageLogVo">
|
||||
select id, model_title, method, type_id, pre_store_num, in_num, out_num, back_num, pass_num, maintenance_num, scrap_num, post_store_num, task_id, agreement_id, manage_type, type_name, type_model_name, result_code, result_msg, remark, status, json_result, creator, create_time, update_time from bm_storage_log
|
||||
select id, model_title, method, type_id, pre_store_num, in_num, out_num, back_num, pass_num, repair_num, scrap_num, post_store_num, task_id, agreement_id, manage_type, type_name, type_model_name, result_code, result_msg, remark, status, json_result, creator, create_time, update_time from bm_storage_log
|
||||
</sql>
|
||||
|
||||
<select id="selectBmStorageLogList" parameterType="com.bonus.material.basic.domain.BmStorageLog" resultMap="BmStorageLogResult">
|
||||
|
|
@ -46,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="outNum != null "> and out_num = #{outNum}</if>
|
||||
<if test="backNum != null "> and back_num = #{backNum}</if>
|
||||
<if test="passNum != null "> and pass_num = #{passNum}</if>
|
||||
<if test="maintenanceNum != null "> and maintenance_num = #{maintenanceNum}</if>
|
||||
<if test="repairNum != null "> and repair_num = #{repairNum}</if>
|
||||
<if test="scrapNum != null "> and scrap_num = #{scrapNum}</if>
|
||||
<if test="postStoreNum != null "> and post_store_num = #{postStoreNum}</if>
|
||||
<if test="taskId != null and taskId != ''"> and task_id = #{taskId}</if>
|
||||
|
|
@ -78,7 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="outNum != null">out_num,</if>
|
||||
<if test="backNum != null">back_num,</if>
|
||||
<if test="passNum != null">pass_num,</if>
|
||||
<if test="maintenanceNum != null">maintenance_num,</if>
|
||||
<if test="repairNum != null">repair_num,</if>
|
||||
<if test="scrapNum != null">scrap_num,</if>
|
||||
<if test="postStoreNum != null">post_store_num,</if>
|
||||
<if test="taskId != null">task_id,</if>
|
||||
|
|
@ -104,7 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="outNum != null">#{outNum},</if>
|
||||
<if test="backNum != null">#{backNum},</if>
|
||||
<if test="passNum != null">#{passNum},</if>
|
||||
<if test="maintenanceNum != null">#{maintenanceNum},</if>
|
||||
<if test="repairNum != null">#{repairNum},</if>
|
||||
<if test="scrapNum != null">#{scrapNum},</if>
|
||||
<if test="postStoreNum != null">#{postStoreNum},</if>
|
||||
<if test="taskId != null">#{taskId},</if>
|
||||
|
|
@ -134,7 +134,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="outNum != null">out_num = #{outNum},</if>
|
||||
<if test="backNum != null">back_num = #{backNum},</if>
|
||||
<if test="passNum != null">pass_num = #{passNum},</if>
|
||||
<if test="maintenanceNum != null">maintenance_num = #{maintenanceNum},</if>
|
||||
<if test="repairNum != null">repair_num = #{repairNum},</if>
|
||||
<if test="scrapNum != null">scrap_num = #{scrapNum},</if>
|
||||
<if test="postStoreNum != null">post_store_num = #{postStoreNum},</if>
|
||||
<if test="taskId != null">task_id = #{taskId},</if>
|
||||
|
|
|
|||
|
|
@ -23,9 +23,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select unit_id, unit_name, status, type_id, link_man, telphone, dept_id, del_flag, create_by, create_time, update_by, update_time, remark from bm_unit
|
||||
</sql>
|
||||
|
||||
<select id="selectBmUnitList" parameterType="com.bonus.material.basic.domain.BmUnit" resultMap="BmUnitResult">
|
||||
<select id="selectBmUnitList1" parameterType="com.bonus.material.basic.domain.BmUnit" resultMap="BmUnitResult">
|
||||
<include refid="selectBmUnitVo"/>
|
||||
<where>
|
||||
<where>
|
||||
del_flag = 0
|
||||
<if test="unitName != null and unitName != ''"> and unit_name like concat('%', #{unitName}, '%')</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
<if test="typeId != null "> and type_id = #{typeId}</if>
|
||||
|
|
@ -35,11 +36,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectBmUnitByUnitId" parameterType="Long" resultMap="BmUnitResult">
|
||||
<include refid="selectBmUnitVo"/>
|
||||
where unit_id = #{unitId}
|
||||
|
||||
|
||||
<select id="selectBmUnitByProName" resultType="com.bonus.material.basic.domain.BmUnit">
|
||||
select unit_id as unitId, unit_name as unitName from bm_unit where del_flag = 0 and unit_name = #{unitName}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectBmUnitPersonByUnitId" resultType="java.lang.Integer">
|
||||
select count(1) from bm_unit_person where unit_id = #{unitId}
|
||||
</select>
|
||||
|
||||
<select id="selectBmUnitList" resultType="com.bonus.material.basic.domain.BmUnit">
|
||||
select unit_id as unitId, unit_name as unitName, status as status, type_id as typeId, link_man as
|
||||
linkMan, telphone as telphone,
|
||||
dept_id as deptId, del_flag as delFlag, create_by as createBy, create_time as createTime,
|
||||
update_by as updateBy, update_time as updateTime, remark as remark from bm_unit
|
||||
where
|
||||
del_flag = 0
|
||||
<if test="unitName != null and unitName != ''">and unit_name like concat('%', #{unitName}, '%')</if>
|
||||
</select>
|
||||
|
||||
<select id="selectBmUnitByUnitId" resultType="com.bonus.material.basic.domain.BmUnit">
|
||||
select unit_id as unitId,
|
||||
unit_name as unitName,
|
||||
status as status,
|
||||
type_id as typeId,
|
||||
link_man as linkMan,
|
||||
telphone as telphone,
|
||||
dept_id as deptId,
|
||||
del_flag as delFlag,
|
||||
create_by as createBy,
|
||||
create_time as createTime,
|
||||
update_by as updateBy,
|
||||
update_time as updateTime,
|
||||
remark as remark
|
||||
from bm_unit
|
||||
where del_flag = 0 and unit_id = #{unitId}
|
||||
</select>
|
||||
|
||||
<insert id="insertBmUnit" parameterType="com.bonus.material.basic.domain.BmUnit" useGeneratedKeys="true" keyProperty="unitId">
|
||||
insert into bm_unit
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
|
@ -49,7 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="linkMan != null">link_man,</if>
|
||||
<if test="telphone != null">telphone,</if>
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
del_flag,
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
|
|
@ -63,7 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="linkMan != null">#{linkMan},</if>
|
||||
<if test="telphone != null">#{telphone},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
0,
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
|
|
@ -81,9 +115,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="linkMan != null">link_man = #{linkMan},</if>
|
||||
<if test="telphone != null">telphone = #{telphone},</if>
|
||||
<if test="deptId != null">dept_id = #{deptId},</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>
|
||||
|
|
@ -92,11 +123,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</update>
|
||||
|
||||
<delete id="deleteBmUnitByUnitId" parameterType="Long">
|
||||
delete from bm_unit where unit_id = #{unitId}
|
||||
update bm_unit set del_flag = 2 where unit_id = #{unitId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBmUnitByUnitIds" parameterType="String">
|
||||
delete from bm_unit where unit_id in
|
||||
update bm_unit set del_flag = 2 where unit_id in
|
||||
<foreach item="unitId" collection="array" open="(" separator="," close=")">
|
||||
#{unitId}
|
||||
</foreach>
|
||||
|
|
|
|||
|
|
@ -3,70 +3,72 @@
|
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.material.basic.mapper.BmUnitPersonMapper">
|
||||
<resultMap type="com.bonus.material.basic.domain.BmUnitPerson" id="BmUnitPersonResult">
|
||||
<result property="ID" column="ID" />
|
||||
<result property="unitId" column="unit_id" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="companyId" column="company_id" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBmUnitPersonVo">
|
||||
select ID, unit_id, user_id, company_id, create_time, update_time from bm_unit_person
|
||||
</sql>
|
||||
<select id="selectDeptTree" resultType="com.bonus.common.biz.domain.TreeNode">
|
||||
<choose>
|
||||
<!-- 当 isTree 为 1 时执行 -->
|
||||
<when test="isTree != null and isTree == 1">
|
||||
SELECT
|
||||
d.dept_id AS id,
|
||||
d.parent_id AS parentId,
|
||||
d.ancestors,
|
||||
d.dept_name AS label,
|
||||
d.order_num,
|
||||
d.leader,
|
||||
d.phone,
|
||||
d.email,
|
||||
d.status,
|
||||
d.del_flag,
|
||||
d.create_by,
|
||||
d.create_time
|
||||
FROM sys_dept d
|
||||
WHERE d.del_flag = '0'
|
||||
AND d.status = '0'
|
||||
AND (LENGTH(d.ancestors) - LENGTH(REPLACE(d.ancestors, ',', ''))) + 1 != 3
|
||||
</when>
|
||||
<!-- 否则执行默认查询 -->
|
||||
<otherwise>
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
d.dept_id AS id,
|
||||
d.parent_id AS parentId,
|
||||
d.dept_name AS label
|
||||
FROM sys_dept d
|
||||
WHERE d.del_flag = '0'
|
||||
AND d.STATUS = '0'
|
||||
UNION
|
||||
SELECT
|
||||
su.user_id AS id,
|
||||
su.dept_id AS parentId,
|
||||
su.user_name AS label
|
||||
FROM sys_user su
|
||||
LEFT JOIN sys_dept sd ON su.dept_id = sd.dept_id
|
||||
) AS combined_results
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<select id="selectBmUnitPersonList" parameterType="com.bonus.material.basic.domain.BmUnitPerson" resultMap="BmUnitPersonResult">
|
||||
<include refid="selectBmUnitPersonVo"/>
|
||||
<where>
|
||||
<if test="userId != null "> and user_id = #{userId}</if>
|
||||
<if test="companyId != null and companyId != ''"> and company_id = #{companyId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectBmUnitPersonByID" parameterType="Long" resultMap="BmUnitPersonResult">
|
||||
<include refid="selectBmUnitPersonVo"/>
|
||||
where ID = #{ID}
|
||||
</select>
|
||||
|
||||
<insert id="insertBmUnitPerson" parameterType="com.bonus.material.basic.domain.BmUnitPerson" useGeneratedKeys="true" keyProperty="ID">
|
||||
<insert id="insertBmUnitPerson" parameterType="com.bonus.material.basic.domain.BmUnitPerson">
|
||||
insert into bm_unit_person
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="unitId != null">unit_id,</if>
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="companyId != null">company_id,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="unitId != null">#{unitId},</if>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="companyId != null">#{companyId},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateBmUnitPerson" parameterType="com.bonus.material.basic.domain.BmUnitPerson">
|
||||
update bm_unit_person
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="unitId != null">unit_id = #{unitId},</if>
|
||||
<if test="userId != null">user_id = #{userId},</if>
|
||||
<if test="companyId != null">company_id = #{companyId},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where ID = #{ID}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBmUnitPersonByID" parameterType="Long">
|
||||
delete from bm_unit_person where ID = #{ID}
|
||||
delete from bm_unit_person where unit_id = #{unitId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBmUnitPersonByIDs" parameterType="String">
|
||||
delete from bm_unit_person where ID in
|
||||
<foreach item="ID" collection="array" open="(" separator="," close=")">
|
||||
#{ID}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
|
|
@ -37,41 +37,150 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select ma_id, type_id, ma_code, pre_code, ma_status, qr_code, buy_price, ma_vender, out_fac_time, out_fac_code, assets_code, check_man, this_check_time, next_check_time, gps_code, rfid_code, erp_code, transfer_code, in_out_num, buy_task, own_house, company_id, create_time, update_time, inspect_man, inspect_status, phone from ma_machine
|
||||
</sql>
|
||||
|
||||
<select id="selectMachineList" parameterType="com.bonus.material.ma.domain.Machine" resultMap="MachineResult">
|
||||
<include refid="selectMachineVo"/>
|
||||
<where>
|
||||
<if test="typeId != null "> and type_id = #{typeId}</if>
|
||||
<if test="maCode != null and maCode != ''"> and ma_code = #{maCode}</if>
|
||||
<if test="preCode != null and preCode != ''"> and pre_code = #{preCode}</if>
|
||||
<if test="maStatus != null and maStatus != ''"> and ma_status = #{maStatus}</if>
|
||||
<if test="qrCode != null and qrCode != ''"> and qr_code = #{qrCode}</if>
|
||||
<if test="buyPrice != null "> and buy_price = #{buyPrice}</if>
|
||||
<if test="maVender != null and maVender != ''"> and ma_vender = #{maVender}</if>
|
||||
<if test="outFacTime != null "> and out_fac_time = #{outFacTime}</if>
|
||||
<if test="outFacCode != null and outFacCode != ''"> and out_fac_code = #{outFacCode}</if>
|
||||
<if test="assetsCode != null and assetsCode != ''"> and assets_code = #{assetsCode}</if>
|
||||
<if test="checkMan != null and checkMan != ''"> and check_man = #{checkMan}</if>
|
||||
<if test="thisCheckTime != null "> and this_check_time = #{thisCheckTime}</if>
|
||||
<if test="nextCheckTime != null "> and next_check_time = #{nextCheckTime}</if>
|
||||
<if test="gpsCode != null and gpsCode != ''"> and gps_code = #{gpsCode}</if>
|
||||
<if test="rfidCode != null and rfidCode != ''"> and rfid_code = #{rfidCode}</if>
|
||||
<if test="erpCode != null and erpCode != ''"> and erp_code = #{erpCode}</if>
|
||||
<if test="transferCode != null and transferCode != ''"> and transfer_code = #{transferCode}</if>
|
||||
<if test="inOutNum != null "> and in_out_num = #{inOutNum}</if>
|
||||
<if test="buyTask != null and buyTask != ''"> and buy_task = #{buyTask}</if>
|
||||
<if test="ownHouse != null and ownHouse != ''"> and own_house = #{ownHouse}</if>
|
||||
<if test="companyId != null and companyId != ''"> and company_id = #{companyId}</if>
|
||||
<if test="inspectMan != null and inspectMan != ''"> and inspect_man = #{inspectMan}</if>
|
||||
<if test="inspectStatus != null and inspectStatus != ''"> and inspect_status = #{inspectStatus}</if>
|
||||
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
|
||||
</where>
|
||||
<select id="selectMachineList" resultType="com.bonus.material.ma.vo.MachineVo">
|
||||
SELECT
|
||||
ma.ma_id as maId,
|
||||
ma.type_id as typeId,
|
||||
mt4.type_name as itemType,
|
||||
mt3.type_name as materialType,
|
||||
mt2.type_name as materialName,
|
||||
mt.type_name as materialModel,
|
||||
ma.ma_code as maCode,
|
||||
ma.pre_code as preCode,
|
||||
ma.ma_status as maStatus,
|
||||
ma.qr_code as qrCode,
|
||||
ma.buy_price as buyPrice,
|
||||
ma.ma_vender as maVender,
|
||||
ma.out_fac_time as outFacTime,
|
||||
ma.out_fac_code as outFacCode,
|
||||
ma.assets_code as assetsCode,
|
||||
ma.check_man as checkMan,
|
||||
ma.this_check_time as thisCheckTime,
|
||||
ma.next_check_time as nextCheckTime,
|
||||
ma.gps_code as gpsCode,
|
||||
ma.rfid_code as rfidCode,
|
||||
ma.erp_code as erpCode,
|
||||
ma.transfer_code as transferCode,
|
||||
ma.in_out_num as inOutNum,
|
||||
ma.buy_task as buyTask,
|
||||
ma.own_house as ownHouse,
|
||||
ma.company_id as companyId,
|
||||
ma.create_time as createTime,
|
||||
ma.update_time as updateTime,
|
||||
ma.inspect_man as inspectMan,
|
||||
ma.inspect_status as inspectStatus,
|
||||
ma.phone as phone
|
||||
FROM
|
||||
ma_machine ma
|
||||
LEFT JOIN ma_type mt ON ma.type_id = mt.type_id
|
||||
and mt.`level` = '4' and mt.del_flag = '0'
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||
and mt2.`level` = '3' and mt2.del_flag = '0'
|
||||
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id
|
||||
and mt3.`level` = '2' and mt3.del_flag = '0'
|
||||
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id
|
||||
and mt4.`level` = '1' and mt4.del_flag = '0'
|
||||
where
|
||||
1 = 1
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
and (
|
||||
ma.ma_code like concat('%', #{keyWord}, '%')
|
||||
or ma.assets_code like concat('%', #{keyWord}, '%')
|
||||
or ma.pre_code like concat('%', #{keyWord}, '%')
|
||||
or ma.buy_task like concat('%', #{keyWord}, '%')
|
||||
or ma.own_house like concat('%', #{keyWord}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="materialType != null and materialType != ''">
|
||||
and mt3.type_name like concat('%', #{materialType}, '%')
|
||||
</if>
|
||||
<if test="materialName != null and materialName != ''">
|
||||
and mt2.type_name like concat('%', #{materialName}, '%')
|
||||
</if>
|
||||
<if test="materialModel != null and materialModel != ''">
|
||||
and mt.type_name like concat('%', #{materialModel}, '%')
|
||||
</if>
|
||||
<if test="isAssets != null">
|
||||
<if test="isAssets == 0">
|
||||
AND ma.assets_code IS NOT NULL
|
||||
AND ma.assets_code != ''
|
||||
</if>
|
||||
<if test="isAssets == 1">
|
||||
AND (ma.assets_code IS NULL OR ma.assets_code = '')
|
||||
</if>
|
||||
</if>
|
||||
order by ma.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectMachineByMaId" parameterType="Long" resultMap="MachineResult">
|
||||
<include refid="selectMachineVo"/>
|
||||
where ma_id = #{maId}
|
||||
|
||||
<select id="selectMachineByMaId" resultType="com.bonus.material.ma.vo.MachineVo">
|
||||
SELECT
|
||||
ma.ma_id as maId,
|
||||
ma.type_id as typeId,
|
||||
mt4.type_name as itemType,
|
||||
mt3.type_name as materialType,
|
||||
mt2.type_name as materialName,
|
||||
mt.type_name as materialModel,
|
||||
ma.ma_code as maCode,
|
||||
ma.pre_code as preCode,
|
||||
ma.ma_status as maStatus,
|
||||
ma.qr_code as qrCode,
|
||||
ma.buy_price as buyPrice,
|
||||
ma.ma_vender as maVender,
|
||||
ma.out_fac_time as outFacTime,
|
||||
ma.out_fac_code as outFacCode,
|
||||
ma.assets_code as assetsCode,
|
||||
ma.check_man as checkMan,
|
||||
ma.this_check_time as thisCheckTime,
|
||||
ma.next_check_time as nextCheckTime,
|
||||
ma.gps_code as gpsCode,
|
||||
ma.rfid_code as rfidCode,
|
||||
ma.erp_code as erpCode,
|
||||
ma.transfer_code as transferCode,
|
||||
ma.in_out_num as inOutNum,
|
||||
ma.buy_task as buyTask,
|
||||
ma.own_house as ownHouse,
|
||||
ma.company_id as companyId,
|
||||
ma.create_time as createTime,
|
||||
ma.update_time as updateTime,
|
||||
ma.inspect_man as inspectMan,
|
||||
ma.inspect_status as inspectStatus,
|
||||
ma.phone as phone,
|
||||
mtk.user_id as keeperId,
|
||||
mtr.user_id as repairId,
|
||||
baa.asset_name as assetName,
|
||||
ma.remark as remark
|
||||
FROM
|
||||
ma_machine ma
|
||||
LEFT JOIN ma_type mt ON ma.type_id = mt.type_id
|
||||
and mt.`level` = '4' and mt.del_flag = '0'
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||
and mt2.`level` = '3' and mt2.del_flag = '0'
|
||||
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id
|
||||
and mt3.`level` = '2' and mt3.del_flag = '0'
|
||||
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id
|
||||
and mt4.`level` = '1' and mt4.del_flag = '0'
|
||||
LEFT JOIN ma_type_keeper mtk on ma.type_id = mtk.type_id
|
||||
LEFT JOIN ma_type_repair mtr on ma.type_id = mtr.type_id
|
||||
LEFT JOIN bm_asset_attributes baa on ma.assets_id = baa.id
|
||||
where ma.ma_id = #{maId}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectByTypeList" resultType="com.bonus.material.ma.domain.Type">
|
||||
SELECT
|
||||
type_id as typeId,
|
||||
type_name as typeName,
|
||||
parent_id as parentId,
|
||||
storage_num as storageNum,
|
||||
type_code as typeCode,
|
||||
level as level
|
||||
FROM
|
||||
ma_type
|
||||
WHERE del_flag = '0'
|
||||
<if test="level != null and level != ''">
|
||||
and level = #{level}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<insert id="insertMachine" parameterType="com.bonus.material.ma.domain.Machine" useGeneratedKeys="true" keyProperty="maId">
|
||||
insert into ma_machine
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
|
@ -156,7 +265,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="buyTask != null">buy_task = #{buyTask},</if>
|
||||
<if test="ownHouse != null">own_house = #{ownHouse},</if>
|
||||
<if test="companyId != null">company_id = #{companyId},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="inspectMan != null">inspect_man = #{inspectMan},</if>
|
||||
<if test="inspectStatus != null">inspect_status = #{inspectStatus},</if>
|
||||
|
|
|
|||
|
|
@ -4,12 +4,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.material.ma.mapper.PartTypeMapper">
|
||||
<resultMap type="com.bonus.material.ma.domain.PartType" id="PartTypeResult">
|
||||
<result property="paId" column="pa_id" />
|
||||
<result property="id" column="pa_id" />
|
||||
<result property="paName" column="pa_name" />
|
||||
<result property="parentId" column="parent_id" />
|
||||
<result property="status" column="status" />
|
||||
<result property="storageNum" column="storage_num" />
|
||||
<result property="unitId" column="unit_id" />
|
||||
<result property="unitName" column="unit_name" />
|
||||
<result property="buyPrice" column="buy_price" />
|
||||
<result property="level" column="level" />
|
||||
<result property="warnNum" column="warn_num" />
|
||||
|
|
@ -20,35 +21,73 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="companyId" column="company_id" />
|
||||
<result property="year" column="year" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPartTypeVo">
|
||||
select pa_id, pa_name, parent_id, status, storage_num, unit_id, buy_price, level, warn_num, del_flag, create_by, update_by, create_time, update_time, remark, company_id, year from ma_part_type
|
||||
select pa_id, pa_name, parent_id, status, storage_num, unit_id, unit_name, buy_price, level, warn_num, del_flag, create_by, update_by, create_time, update_time, remark, company_id from ma_part_type
|
||||
</sql>
|
||||
|
||||
<select id="selectPartTypeList" parameterType="com.bonus.material.ma.domain.PartType" resultMap="PartTypeResult">
|
||||
<include refid="selectPartTypeVo"/>
|
||||
<where>
|
||||
<if test="paName != null and paName != ''"> and pa_name like concat('%', #{paName}, '%')</if>
|
||||
<if test="parentId != null "> and parent_id = #{parentId}</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
<if test="storageNum != null "> and storage_num = #{storageNum}</if>
|
||||
<if test="unitId != null and unitId != ''"> and unit_id = #{unitId}</if>
|
||||
<if test="buyPrice != null "> and buy_price = #{buyPrice}</if>
|
||||
<if test="level != null and level != ''"> and level = #{level}</if>
|
||||
<if test="warnNum != null "> and warn_num = #{warnNum}</if>
|
||||
<if test="companyId != null and companyId != ''"> and company_id = #{companyId}</if>
|
||||
<if test="year != null and year != ''"> and year = #{year}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectPartTypeByPaId" parameterType="Long" resultMap="PartTypeResult">
|
||||
<include refid="selectPartTypeVo"/>
|
||||
where pa_id = #{paId}
|
||||
where pa_id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertPartType" parameterType="com.bonus.material.ma.domain.PartType" useGeneratedKeys="true" keyProperty="paId">
|
||||
|
||||
<select id="getPartTree" resultType="com.bonus.common.biz.domain.TreeNode">
|
||||
SELECT pa_id AS id,
|
||||
pa_name AS label,
|
||||
parent_id AS parentId,
|
||||
level
|
||||
FROM ma_part_type
|
||||
WHERE del_flag = '0' and level != '3'
|
||||
ORDER BY create_time
|
||||
</select>
|
||||
|
||||
<select id="selectPartTypeList" resultType="com.bonus.common.biz.domain.TreeNode">
|
||||
select pa_id as id, pa_name as label, parent_id as parentId, storage_num as storageNum, unit_name as unitName, buy_price as buyPrice, level as level, remark as remark from ma_part_type
|
||||
where del_flag = '0'
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
and (
|
||||
pa_name like concat('%', #{keyWord}, '%')
|
||||
or storage_num like concat('%', #{keyWord}, '%')
|
||||
or unit_name = #{keyWord},
|
||||
or buy_price like concat('%', #{keyWord}, '%')
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getTypeList" resultType="com.bonus.material.ma.domain.PartType">
|
||||
select pa_id as id, pa_name as paName, parent_id as parentId, storage_num as storageNum, unit_name as unitName, buy_price as buyPrice, level as level, remark as remark from ma_part_type
|
||||
where del_flag = '0'
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
and (
|
||||
pa_name like concat('%', #{keyWord}, '%')
|
||||
or storage_num like concat('%', #{keyWord}, '%')
|
||||
or unit_name = #{keyWord},
|
||||
or buy_price like concat('%', #{keyWord}, '%')
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectByName" resultType="com.bonus.material.ma.domain.PartType">
|
||||
select pa_id as id, pa_name as paName, parent_id as parentId, storage_num as storageNum, unit_name as unitName, buy_price as buyPrice, level as level, remark as remark from ma_part_type
|
||||
where del_flag = '0'
|
||||
<if test="paName != null and paName != ''">
|
||||
AND pa_name = #{paName}
|
||||
</if>
|
||||
<if test="parentId != null">
|
||||
AND parent_id = #{parentId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectById" resultType="java.lang.Integer">
|
||||
select count(*) from ma_part_type where parent_id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectPart" resultType="java.lang.Integer">
|
||||
select count(*) from repair_apply_record where part_id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertPartType" parameterType="com.bonus.material.ma.domain.PartType">
|
||||
insert into ma_part_type
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="paName != null and paName != ''">pa_name,</if>
|
||||
|
|
@ -56,17 +95,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="status != null">status,</if>
|
||||
<if test="storageNum != null">storage_num,</if>
|
||||
<if test="unitId != null">unit_id,</if>
|
||||
<if test="unitName != null">unit_name,</if>
|
||||
<if test="buyPrice != null">buy_price,</if>
|
||||
<if test="level != null">level,</if>
|
||||
<if test="warnNum != null">warn_num,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
del_flag,
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="companyId != null">company_id,</if>
|
||||
<if test="year != null">year,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="paName != null and paName != ''">#{paName},</if>
|
||||
|
|
@ -74,17 +113,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="status != null">#{status},</if>
|
||||
<if test="storageNum != null">#{storageNum},</if>
|
||||
<if test="unitId != null">#{unitId},</if>
|
||||
<if test="unitName != null">#{unitName},</if>
|
||||
<if test="buyPrice != null">#{buyPrice},</if>
|
||||
<if test="level != null">#{level},</if>
|
||||
<if test="warnNum != null">#{warnNum},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
0,
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="companyId != null">#{companyId},</if>
|
||||
<if test="year != null">#{year},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
|
@ -96,29 +135,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="status != null">status = #{status},</if>
|
||||
<if test="storageNum != null">storage_num = #{storageNum},</if>
|
||||
<if test="unitId != null">unit_id = #{unitId},</if>
|
||||
<if test="unitName != null">unit_name = #{unitName},</if>
|
||||
<if test="buyPrice != null">buy_price = #{buyPrice},</if>
|
||||
<if test="level != null">level = #{level},</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="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="companyId != null">company_id = #{companyId},</if>
|
||||
<if test="year != null">year = #{year},</if>
|
||||
</trim>
|
||||
where pa_id = #{paId}
|
||||
where pa_id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deletePartTypeByPaId" parameterType="Long">
|
||||
delete from ma_part_type where pa_id = #{paId}
|
||||
update ma_part_type set del_flag = '2' where pa_id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deletePartTypeByPaIds" parameterType="String">
|
||||
delete from ma_part_type where pa_id in
|
||||
<foreach item="paId" collection="array" open="(" separator="," close=")">
|
||||
#{paId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
Binary file not shown.
Loading…
Reference in New Issue