From a5ec76ab8a70a4f7c2b62032d5aefd0025ee5513 Mon Sep 17 00:00:00 2001 From: mashuai Date: Wed, 14 Aug 2024 16:38:46 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/bonus/base/api/domain/MaType.java | 14 +- .../com/bonus/base/api/domain/TreeSelect.java | 14 + .../common/core/web/domain/BaseEntity.java | 10 + .../material/controller/MaTypeController.java | 73 ++++- .../bonus/material/mapper/MaTypeMapper.java | 62 +++-- .../bonus/material/service/MaTypeService.java | 41 ++- .../service/impl/MaTypeServiceImpl.java | 135 ++++++++-- .../java/com/bonus/material/vo/MaTypeVo.java | 45 ++++ .../main/resources/mapper/MaTypeMapper.xml | 249 ++++++++++-------- .../controller/SysProfileController.java | 2 +- 10 files changed, 473 insertions(+), 172 deletions(-) create mode 100644 bonus-modules/bonus-material/src/main/java/com/bonus/material/vo/MaTypeVo.java diff --git a/bonus-api/bonus-api-system/src/main/java/com/bonus/base/api/domain/MaType.java b/bonus-api/bonus-api-system/src/main/java/com/bonus/base/api/domain/MaType.java index 4f2dcef..f99603b 100644 --- a/bonus-api/bonus-api-system/src/main/java/com/bonus/base/api/domain/MaType.java +++ b/bonus-api/bonus-api-system/src/main/java/com/bonus/base/api/domain/MaType.java @@ -1,5 +1,6 @@ package com.bonus.base.api.domain; +import com.bonus.common.core.web.domain.BaseEntity; import com.fasterxml.jackson.annotation.JsonInclude; import lombok.AllArgsConstructor; import lombok.Data; @@ -18,7 +19,7 @@ import java.util.List; @Data @AllArgsConstructor @NoArgsConstructor -public class MaType implements Serializable { +public class MaType extends BaseEntity implements Serializable { private static final long serialVersionUID = 135108051525707131L; /** * id @@ -32,6 +33,17 @@ public class MaType implements Serializable { * 名称 */ private String name; + + /** + * 父级名称 + */ + private String parentName; + + /** + * 编码 + */ + private String code; + /** * 层级 */ diff --git a/bonus-api/bonus-api-system/src/main/java/com/bonus/base/api/domain/TreeSelect.java b/bonus-api/bonus-api-system/src/main/java/com/bonus/base/api/domain/TreeSelect.java index 92dc8d6..af660ad 100644 --- a/bonus-api/bonus-api-system/src/main/java/com/bonus/base/api/domain/TreeSelect.java +++ b/bonus-api/bonus-api-system/src/main/java/com/bonus/base/api/domain/TreeSelect.java @@ -23,6 +23,11 @@ public class TreeSelect implements Serializable private Integer level; + /** + * 编码 + */ + private String code; + private Integer parentId; private String companyId; @@ -34,6 +39,7 @@ public class TreeSelect implements Serializable public TreeSelect(MaType maType) { this.parentId = maType.getParentId(); + this.code = maType.getCode(); this.level = Integer.valueOf(maType.getLevel()); this.id = maType.getId(); this.label = maType.getName(); @@ -50,6 +56,14 @@ public class TreeSelect implements Serializable this.parentId = parentId; } + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + public Integer getId() { diff --git a/bonus-common/bonus-common-core/src/main/java/com/bonus/common/core/web/domain/BaseEntity.java b/bonus-common/bonus-common-core/src/main/java/com/bonus/common/core/web/domain/BaseEntity.java index a9ab2e2..680b3c2 100644 --- a/bonus-common/bonus-common-core/src/main/java/com/bonus/common/core/web/domain/BaseEntity.java +++ b/bonus-common/bonus-common-core/src/main/java/com/bonus/common/core/web/domain/BaseEntity.java @@ -45,6 +45,8 @@ public class BaseEntity implements Serializable /** 创建人 */ private String creator; + private String keyWord; + /** 请求参数 */ @JsonInclude(JsonInclude.Include.NON_EMPTY) private Map params; @@ -113,6 +115,14 @@ public class BaseEntity implements Serializable this.creator = creator; } + public String getKeyWord() { + return keyWord; + } + + public void setKeyWord(String keyWord) { + this.keyWord = keyWord; + } + public Map getParams() { diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/controller/MaTypeController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/controller/MaTypeController.java index f171de7..fab988f 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/controller/MaTypeController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/controller/MaTypeController.java @@ -2,17 +2,18 @@ package com.bonus.material.controller; import com.bonus.base.api.domain.MaType; import com.bonus.base.api.domain.TreeSelect; +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.security.annotation.RequiresPermissions; import com.bonus.material.service.MaTypeService; +import com.bonus.material.vo.MaTypeVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.PageRequest; -import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; import java.util.List; /** @@ -34,16 +35,49 @@ public class MaTypeController extends BaseController { /** * 根据类型名称查询类型树 * - * @param typeName 类型名称 * @return 查询结果 */ @ApiOperation(value = "根据类型名称查询类型树") + @RequiresPermissions("material:maType:query") @GetMapping("/getMaTypeList") - public AjaxResult queryByPage(@RequestParam(required = false, value = "typeName") String typeName) { - List maTypeList = maTypeService.getMaTypeList(typeName); + public AjaxResult queryByPage() { + List maTypeList = maTypeService.getMaTypeList(); return AjaxResult.success(maTypeList); } + /** + * 根据左列表类型id查询右表格 + * + * @param maType + * @return + */ + @ApiOperation(value = "根据左列表类型id查询右表格") + @RequiresPermissions("material:maType:query") + @GetMapping("/getListByMaType") + public AjaxResult getListByMaType(MaType maType) { + startPage(); + List listByMaType = maTypeService.getListByParentId(maType); + return success(getDataTable(listByMaType)); + } + + /** + * 新增数据返回code + * + * @param id + * @return 新增结果 + */ + @ApiOperation(value = "新增数据返回code") + @GetMapping("/addMaType") + public AjaxResult addMaType(@RequestParam(value = "id") Integer id) { + MaType maType ; + if (id == 0) { + return success(maTypeService.getNextChildCode(null)); + } else { + maType = maTypeService.findById(id); + return success(maTypeService.getNextChildCode(maType)); + } + } + /** * 新增数据 * @@ -51,6 +85,7 @@ public class MaTypeController extends BaseController { * @return 新增结果 */ @ApiOperation(value = "新增数据") + @RequiresPermissions("material:maType:add") @PostMapping("/add") public AjaxResult add(@RequestBody MaType maType) { return maTypeService.insert(maType); @@ -63,10 +98,36 @@ public class MaTypeController extends BaseController { * @return 编辑结果 */ @ApiOperation(value = "编辑数据") + @RequiresPermissions("material:maType:edit") @PostMapping("/update") public AjaxResult edit(@RequestBody MaType maType) { return maTypeService.update(maType); } + /** + * 逻辑删除 + * + * @param id 主键 + * @return 删除是否成功 + */ + @DeleteMapping("/{id}") + @RequiresPermissions("material:maType:remove") + public AjaxResult deleteById(@PathVariable("id") Integer id) { + return maTypeService.deleteById(id); + } + + /** + * 导出物资类型列表 + */ + @ApiOperation(value = "导出物资类型列表") + @RequiresPermissions("material:maType:export") + @PostMapping("/export") + public void export(HttpServletResponse response, MaType maType) + { + List list = maTypeService.getListByParentId(maType); + ExcelUtil util = new ExcelUtil<>(MaTypeVo.class); + util.exportExcel(response, list, "物资类型数据"); + } + } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/mapper/MaTypeMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/mapper/MaTypeMapper.java index 1750043..69ad4b2 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/mapper/MaTypeMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/mapper/MaTypeMapper.java @@ -1,6 +1,7 @@ package com.bonus.material.mapper; import com.bonus.base.api.domain.MaType; +import com.bonus.material.vo.MaTypeVo; import org.apache.ibatis.annotations.Param; import org.springframework.data.domain.Pageable; import java.util.List; @@ -13,23 +14,6 @@ import java.util.List; */ public interface MaTypeMapper { - /** - * 查询指定行数据 - * - * @param maType 查询条件 - * @param pageable 分页对象 - * @return 对象列表 - */ - List queryAllByLimit(MaType maType, @Param("pageable") Pageable pageable); - - /** - * 统计总行数 - * - * @param maType 查询条件 - * @return 总行数 - */ - long count(MaType maType); - /** * 新增数据 * @@ -72,9 +56,49 @@ public interface MaTypeMapper { /** * 根据名称查询 - * @param typeName * @return */ - List selectMaTypeTree(String typeName); + List selectMaTypeTree(); + + /** + * 根据父级id查询 + * @param maType + * @return + */ + List getListByParentId(MaType maType); + + /** + * 查询最大code + * @return + */ + String selectCode(); + + /** + * 根据父级id查询 + * @param maType + * @return + */ + MaType getNextChildCode(MaType maType); + + /** + * 根据id查询 + * @param id + * @return + */ + MaType findById(Integer id); + + /** + * 根据id查询 + * @param id + * @return + */ + List selectById(Integer id); + + /** + * 根据id删除 + * @param id + * @return + */ + int deleteById(Integer id); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/service/MaTypeService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/service/MaTypeService.java index dc02ee3..c385bb6 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/service/MaTypeService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/service/MaTypeService.java @@ -3,6 +3,7 @@ package com.bonus.material.service; import com.bonus.base.api.domain.MaType; import com.bonus.base.api.domain.TreeSelect; import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.material.vo.MaTypeVo; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; @@ -16,15 +17,6 @@ import java.util.List; */ public interface MaTypeService { - /** - * 分页查询 - * - * @param maType 筛选条件 - * @param pageRequest 分页对象 - * @return 查询结果 - */ - Page queryByPage(MaType maType, PageRequest pageRequest); - /** * 新增数据 * @@ -43,8 +35,35 @@ public interface MaTypeService { /** * 根据类型名称查询类型树 - * @param typeName * @return */ - List getMaTypeList(String typeName); + List getMaTypeList(); + + /** + * 根据左列表类型id查询右表格 + * @param maType + * @return + */ + List getListByParentId(MaType maType); + + /** + * 根据id查询code + * @param maType + * @return + */ + MaTypeVo getNextChildCode(MaType maType); + + /** + * 根据id查询 + * @param id + * @return + */ + MaType findById(Integer id); + + /** + * 根据id删除 + * @param id + * @return + */ + AjaxResult deleteById(Integer id); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/service/impl/MaTypeServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/service/impl/MaTypeServiceImpl.java index c95ec31..d1036a9 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/service/impl/MaTypeServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/service/impl/MaTypeServiceImpl.java @@ -6,6 +6,8 @@ import com.bonus.common.core.utils.StringUtils; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.material.mapper.MaTypeMapper; import com.bonus.material.service.MaTypeService; +import com.bonus.material.vo.MaTypeVo; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Service; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; @@ -28,19 +30,6 @@ public class MaTypeServiceImpl implements MaTypeService { @Resource private MaTypeMapper maTypeDao; - /** - * 分页查询 - * - * @param maType 筛选条件 - * @param pageRequest 分页对象 - * @return 查询结果 - */ - @Override - public Page queryByPage(MaType maType, PageRequest pageRequest) { - long total = this.maTypeDao.count(maType); - return new PageImpl<>(this.maTypeDao.queryAllByLimit(maType, pageRequest), pageRequest, total); - } - /** * 新增数据 * @@ -51,9 +40,10 @@ public class MaTypeServiceImpl implements MaTypeService { public AjaxResult insert(MaType maType) { //根据类型名称判断,去重 MaType type = maTypeDao.queryByName(maType.getName()); - if (type!=null){ - return AjaxResult.error("类型名称重复"); + if (type != null && maType.getId().equals(type.getParentId())) { + return AjaxResult.error("同级下类型名称存在重复!"); } + maType.setLevel(String.valueOf(Integer.parseInt(maType.getLevel()) + 1)); int result = maTypeDao.insert(maType); if (result > 0) { return AjaxResult.success("添加成功"); @@ -83,17 +73,126 @@ public class MaTypeServiceImpl implements MaTypeService { /** * 根据类型名称查询类型树 - * @param typeName * @return */ @Override - public List getMaTypeList(String typeName) { - List maTypes = maTypeDao.selectMaTypeTree(typeName); + public List getMaTypeList() { + List maTypes = maTypeDao.selectMaTypeTree(); List treeSelectList = buildDeptTreeSelect(maTypes); //如果没有查询到那么返回空 return treeSelectList; } + /** + * 根据左列表类型id查询右表格 + * @param maType + * @return + */ + @Override + public List getListByParentId(MaType maType) { + return maTypeDao.getListByParentId(maType); + } + + /** + * 根据id查询code + * @param maType + * @return + */ + @Override + public MaTypeVo getNextChildCode(MaType maType) { + String code = ""; + String c = ""; + String str = ""; + try { + if (maType != null) { + code = maType.getCode(); + c = maType.getCode(); + int len = code.length(); + if (len == 2) { + code += "__"; + } else if (len == 4 || len == 7) { + code += "___"; + } + maType.setCode(code); + maType = maTypeDao.getNextChildCode(maType); + } else { + maType = new MaType(); + maType.setCode("__"); + maType = maTypeDao.getNextChildCode(maType); + } + if (maType == null) { + if (c.length() == 0 || c.length() == 2) { + code = c + "01"; + } else { + code = c + "001"; + } + } else { + code = maType.getCode(); + if (code.length() == 2) { + code = Integer.parseInt(code) + 1 + ""; + if (code.length() == 1) { + code = "0" + code; + } + } else if (code.length() == 4) { + str = code.substring(2, 4); + str = Integer.parseInt(str) + 1 + ""; + if (str.length() == 1) { + str = "0" + str; + } + code = code.substring(0, 2) + str; + } else if (code.length() == 7) { + + str = code.substring(4, 7); + str = Integer.parseInt(str) + 1 + ""; + if (str.length() == 1) { + str = "00" + str; + } else if (str.length() == 2) { + str = "0" + str; + } + code = code.substring(0, 4) + str; + } else if (code.length() == 10) { + str = code.substring(7, 10); + str = Integer.parseInt(str) + 1 + ""; + if (str.length() == 1) { + str = "00" + str; + } else if (str.length() == 2) { + str = "0" + str; + } + code = code.substring(0, 7) + str; + } + } + } catch (Exception e) { + e.printStackTrace(); + } + MaTypeVo maTypeVo = new MaTypeVo(); + maTypeVo.setCode(code); + return maTypeVo; + } + + @Override + public MaType findById(Integer id) { + return maTypeDao.findById(id); + } + + /** + * 根据id删除 + * @param id + * @return + */ + @Override + public AjaxResult deleteById(Integer id) { + //根据id查询删除类型下属是否有关联,有关联无法删除 + List list = maTypeDao.selectById(id); + if (CollectionUtils.isNotEmpty(list)) { + return AjaxResult.error("该类型下有子类型,无法删除"); + } + int result = maTypeDao.deleteById(id); + if (result > 0) { + return AjaxResult.success("删除成功"); + } + return AjaxResult.error("删除失败"); + } + /** * 构建前端所需要下拉树结构 * diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/vo/MaTypeVo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/vo/MaTypeVo.java new file mode 100644 index 0000000..cb14823 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/vo/MaTypeVo.java @@ -0,0 +1,45 @@ +package com.bonus.material.vo; + +import com.bonus.base.api.domain.MaType; +import com.bonus.common.core.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 物资类型返回vo + * @Author ma_sh + * @create 2024/8/13 14:43 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class MaTypeVo extends MaType { + + @ApiModelProperty("类型编码") + @Excel(name = "类型编码") + private String code; + + @ApiModelProperty("仓库信息") + private String wareHouse ; + + @ApiModelProperty("施工类型") + @Excel(name = "施工类型") + private String constructionType; + + @ApiModelProperty("物资类型") + @Excel(name = "物资类型") + private String materialType; + + @ApiModelProperty("物资名称") + @Excel(name = "物资名称") + private String materialName; + + @ApiModelProperty("规格型号") + @Excel(name = "规格型号") + private String specificationCode; + + @ApiModelProperty("新增类型编码") + private String newCode; +} diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/MaTypeMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/MaTypeMapper.xml index a17c296..65234d2 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/MaTypeMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/MaTypeMapper.xml @@ -68,127 +68,144 @@ where id = #{id} + + update ma_type set is_active = '0' where id = #{id} + - - select id, parent_id, name, level, storage_num, unit_id, buy_price, lease_price, manage_type, is_active, rate_load, test_load, hold_time, file_url, company_id from ma_type - - - and id = #{id} - - - and parent_id = #{parentId} - - - and name = #{name} - - - and level = #{level} - - - and storage_num = #{storageNum} - - - and unit_id = #{unitId} - - - and buy_price = #{buyPrice} - - - and lease_price = #{leasePrice} - - - and manage_type = #{manageType} - - - and is_active = #{isActive} - - - and rate_load = #{rateLoad} - - - and test_load = #{testLoad} - - - and hold_time = #{holdTime} - - - and file_url = #{fileUrl} - - - and company_id = #{companyId} - - - limit #{pageable.offset}, #{pageable.pageSize} + where name = #{name} and is_active = '1' - - - - select - id, parent_id, name, level, storage_num, unit_id, buy_price, lease_price, manage_type, is_active, rate_load, test_load, hold_time, file_url, company_id + id, code, parent_id, name, level, storage_num, unit_id, buy_price, lease_price, manage_type, is_active, rate_load, test_load, hold_time, file_url, company_id from ma_type - where name = #{name} + where level != '4' and is_active = '1' - + SELECT + t.* + FROM + ( + SELECT + mt.id, + mt.`name` AS specificationCode, + mt.`level`, + mtp.`name` AS materialName, + s.`name` AS materialType, + f.`name` AS constructionType, + mt.`code`, + mt.is_active + FROM + ma_type mt + LEFT JOIN ma_type mtp ON mtp.id = mt.parent_id + LEFT JOIN ma_type s ON s.id = mtp.parent_id + LEFT JOIN ma_type f ON f.id = s.parent_id + WHERE + mt.`LEVEL` = 4 UNION + SELECT + mt.id, + NULL AS `NAME`, + mt.`level`, + mt.`name` AS materialName, + mtp.`name` AS materialType, + s.`name` AS constructionType, + mt.`CODE`, + mt.is_active + FROM + ma_type mt + LEFT JOIN ma_type mtp ON mtp.id = mt.PARENT_ID + LEFT JOIN ma_type s ON s.id = mtp.PARENT_ID + WHERE + mt.`LEVEL` = 3 UNION + SELECT + mt.id AS id, + NULL AS `NAME`, + mt.`level`, + NULL AS materialName, + mt.`NAME` AS materialType, + mtp.`NAME` AS constructionType, + mt.`CODE`, + mt.IS_ACTIVE AS enabled + FROM + ma_type mt + LEFT JOIN ma_type mtp ON mtp.id = mt.PARENT_ID + WHERE + mt.`LEVEL` = 2 UNION + SELECT + mt.id AS id, + NULL AS `NAME`, + mt.`level`, + NULL AS materialName, + NULL AS materialType, + mt.`NAME` AS constructionType, + mt.`CODE`, + mt.IS_ACTIVE AS enabled + FROM + ma_type mt + WHERE + mt.`LEVEL` = 1 + ) t + WHERE + t.IS_ACTIVE = '1' + + and ( + t.specificationCode like CONCAT('%',#{keyWord},'%') or + t.`CODE` like CONCAT('%',#{keyWord},'%') or + t.materialName like CONCAT('%',#{keyWord},'%') or + t.materialType like CONCAT('%',#{keyWord},'%') or + t.constructionType like CONCAT('%',#{keyWord},'%') + ) + + + and t.`CODE` like CONCAT(#{code},'%') + + ORDER BY t.`CODE` + + + + + - insert into ma_type(id, parent_id, name, level, storage_num, unit_id, buy_price, lease_price, manage_type, is_active, rate_load, test_load, hold_time, file_url, company_id) @@ -224,16 +241,16 @@ INSERT INTO ma_type - id, - parent_id, + parent_id, name, + code, level, storage_num, unit_id, buy_price, lease_price, manage_type, - is_active, + is_active, rate_load, test_load, hold_time, @@ -243,8 +260,8 @@ VALUES #{id}, - #{parentId}, #{name}, + #{code}, #{level}, #{storageNum}, #{unitId}, diff --git a/bonus-modules/bonus-system/src/main/java/com/bonus/system/controller/SysProfileController.java b/bonus-modules/bonus-system/src/main/java/com/bonus/system/controller/SysProfileController.java index 16a7e33..6401af9 100644 --- a/bonus-modules/bonus-system/src/main/java/com/bonus/system/controller/SysProfileController.java +++ b/bonus-modules/bonus-system/src/main/java/com/bonus/system/controller/SysProfileController.java @@ -110,7 +110,7 @@ public class SysProfileController extends BaseController String username = SecurityUtils.getUsername(); SysUser user = userService.selectUserByUserName(username); String password = user.getPassword(); - String msg= ValidateUtils.isPwd(oldPassword); + String msg= ValidateUtils.isPwd(newPassword); if (StringUtils.isNotEmpty(msg)) { return error(msg); } From 5ad5888949f1cf5ab1c13bc67ba0323ec43434c3 Mon Sep 17 00:00:00 2001 From: mashuai Date: Thu, 15 Aug 2024 10:34:25 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BB=93=E5=BA=93=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/bonus/base/api/domain/BmProject.java | 18 +++ .../com/bonus/base/api/domain/MaHouse.java | 36 ++++++ .../handler/GlobalExceptionHandler.java | 4 +- .../main/resources/mapper/BmProjectMapper.xml | 19 ++- .../controller/MaHouseController.java | 118 ++++++++++++++++++ .../bonus/material/mapper/MaHouseMapper.java | 61 +++++++++ .../material/service/MaHouseService.java | 59 +++++++++ .../service/impl/MaHouseServiceImpl.java | 103 +++++++++++++++ .../main/resources/mapper/MaHouseMapper.xml | 66 ++++++++++ 9 files changed, 477 insertions(+), 7 deletions(-) create mode 100644 bonus-api/bonus-api-system/src/main/java/com/bonus/base/api/domain/MaHouse.java create mode 100644 bonus-modules/bonus-material/src/main/java/com/bonus/material/controller/MaHouseController.java create mode 100644 bonus-modules/bonus-material/src/main/java/com/bonus/material/mapper/MaHouseMapper.java create mode 100644 bonus-modules/bonus-material/src/main/java/com/bonus/material/service/MaHouseService.java create mode 100644 bonus-modules/bonus-material/src/main/java/com/bonus/material/service/impl/MaHouseServiceImpl.java create mode 100644 bonus-modules/bonus-material/src/main/resources/mapper/MaHouseMapper.xml diff --git a/bonus-api/bonus-api-system/src/main/java/com/bonus/base/api/domain/BmProject.java b/bonus-api/bonus-api-system/src/main/java/com/bonus/base/api/domain/BmProject.java index c0afcca..2710e38 100644 --- a/bonus-api/bonus-api-system/src/main/java/com/bonus/base/api/domain/BmProject.java +++ b/bonus-api/bonus-api-system/src/main/java/com/bonus/base/api/domain/BmProject.java @@ -51,6 +51,12 @@ public class BmProject extends BaseEntity implements Serializable { @Min(value = 1, message = "项目类型不能为空") private Integer projectType; + /** + * 项目类型。 1:线路工程;2:变电工程;3:业务工程;4:其他工程 + */ + @ApiModelProperty(value = "工程类型名称") + private String projectTypeName; + /** * i8工程id */ @@ -97,6 +103,12 @@ public class BmProject extends BaseEntity implements Serializable { @ApiModelProperty(value = "项目性质") private String nature; + /** + * 项目性质 + */ + @ApiModelProperty(value = "项目性质名称") + private String natureName; + /** * 联系方式 */ @@ -112,6 +124,12 @@ public class BmProject extends BaseEntity implements Serializable { @Excel(name = "工程状态") private String stats; + /** + * 工程状态 + */ + @ApiModelProperty(value = "工程状态名称") + private String statsName; + /** * 传真 */ diff --git a/bonus-api/bonus-api-system/src/main/java/com/bonus/base/api/domain/MaHouse.java b/bonus-api/bonus-api-system/src/main/java/com/bonus/base/api/domain/MaHouse.java new file mode 100644 index 0000000..f9b0c8e --- /dev/null +++ b/bonus-api/bonus-api-system/src/main/java/com/bonus/base/api/domain/MaHouse.java @@ -0,0 +1,36 @@ +package com.bonus.base.api.domain; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * ma_house物资仓库(MaHouse)实体类 + * + * @author makejava + * @since 2024-08-14 09:22:54 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class MaHouse implements Serializable { + private static final long serialVersionUID = -11758888261312379L; + + private Integer id; + /** + * 0不启用,1启用 + */ + private String isActive; + /** + * 备注 + */ + private String remark; + /** + * 仓库名称 + */ + private String name; + +} + diff --git a/bonus-common/bonus-common-security/src/main/java/com/bonus/common/security/handler/GlobalExceptionHandler.java b/bonus-common/bonus-common-security/src/main/java/com/bonus/common/security/handler/GlobalExceptionHandler.java index 799f793..0d094b6 100644 --- a/bonus-common/bonus-common-security/src/main/java/com/bonus/common/security/handler/GlobalExceptionHandler.java +++ b/bonus-common/bonus-common-security/src/main/java/com/bonus/common/security/handler/GlobalExceptionHandler.java @@ -146,12 +146,12 @@ public class GlobalExceptionHandler /** * 处理系统异常,在其他异常拦截均未捕获时进行兜底处理 - */ + *//* @ExceptionHandler(value = Exception.class) public AjaxResult defaultHandleException(Exception e) { log.error(e.getMessage(), e); return AjaxResult.error(e.getMessage()); - } + }*/ /** * 内部认证异常 diff --git a/bonus-modules/bonus-base/src/main/resources/mapper/BmProjectMapper.xml b/bonus-modules/bonus-base/src/main/resources/mapper/BmProjectMapper.xml index ae6378d..637fd85 100644 --- a/bonus-modules/bonus-base/src/main/resources/mapper/BmProjectMapper.xml +++ b/bonus-modules/bonus-base/src/main/resources/mapper/BmProjectMapper.xml @@ -34,17 +34,23 @@ - id, project_type, `name`, num, manager, nature, telphone, phone, fax, address, remark, - material_clerk, company_id, `time`, - is_active, lon, lat, company, imp_unit, dept_name, pro_id, dept_id, cvo, stats, htzt, is_match + bmp.id, bmp.project_type, sda1.dict_label AS projectTypeName, bmp.name, bmp.num, bmp.manager,bmp.nature, + sda2.dict_label AS natureName, bmp.telphone, bmp.phone, bmp.fax, bmp.address, + bmp.remark, bmp.material_clerk, bmp.company_id, bmp.time, + bmp.is_active, bmp.lon, bmp.lat, bmp.company, bmp.imp_unit, + bmp.dept_name, bmp.pro_id, bmp.dept_id, bmp.cvo, bmp.stats, sda3.dict_label AS statsName, + bmp.htzt, bmp.is_match + select + is_active, remark, name, id + from ma_house + where id = #{id} + + + + + + + + + + insert into ma_house(is_active, remark, name) + values (1, #{remark}, #{name}) + + + + + update ma_house + + + remark = #{remark}, + + + name = #{name}, + + + where id = #{id} + + + + + update ma_house + set is_active = '0' + where id = #{id} + + + +