Compare commits

...

2 Commits

Author SHA1 Message Date
dingjie 81da0279d0 Merge remote-tracking branch 'origin/dev' into dev 2023-12-12 16:58:59 +08:00
dingjie 5eedbacdb5 基础服务管理模块 2023-12-12 16:58:45 +08:00
30 changed files with 1266 additions and 299 deletions

View File

@ -42,12 +42,21 @@ public class MaHouseController extends BaseController {
* @return
*/
@ApiOperation(value = "查询仓库组织树列表")
@GetMapping("/houseTree")
@GetMapping("/tree")
public AjaxResult tree(MaHouse house)
{
return success(houseService.getHouseTree(house));
}
/**
* 获取仓库管理ma_house_info详细信息
*/
@GetMapping(value = "/{houseId}")
public AjaxResult getInfo(@PathVariable("houseId") Long houseId)
{
return success(houseService.selectMaHouseByHouseId(houseId));
}
/**
* 新增仓库货架
*/

View File

@ -39,6 +39,15 @@ public class MaHouseSetController extends BaseController {
return getDataTable(list);
}
/**
* 获取仓库货架配置详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(maHouseSetService.selectMaHouseSetByHouseId(id));
}
/**
* 新增仓库货架配置
*/

View File

@ -1,56 +0,0 @@
package com.bonus.sgzb.base.controller;
import com.bonus.sgzb.base.domain.MaHouseShel;
import com.bonus.sgzb.base.service.MaHouseShelService;
import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
import com.bonus.sgzb.common.security.utils.SecurityUtils;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* MaHouseShelController
* @Author dingjie
* @Date 2023-12-07
**/
@Api("仓库货架管理Controller")
@RestController
@RequestMapping("/houseShel")
public class MaHouseShelController extends BaseController {
@Autowired
private MaHouseShelService houseShelService;
/**
* 查询仓库货架列表
* @param houseShel 货架信息
* @return
*/
@GetMapping("/list")
public TableDataInfo list(MaHouseShel houseShel)
{
startPage();
List<MaHouseShel> list = houseShelService.selectHouseShelList(houseShel);
return getDataTable(list);
}
/**
* 新增仓库货架
*/
@PostMapping
public AjaxResult add(@Validated @RequestBody MaHouseShel houseShel){
// if (!houseShelService.checkHouseNameUnique(houseShel)) {
// return error("新增仓库货架名称'" + houseShel.getShelveName() + "'失败,仓库货架名称已存在");
// }
houseShel.setCreateBy(SecurityUtils.getUsername());
return toAjax(houseShelService.insertHouseShel(houseShel));
}
}

View File

@ -5,6 +5,8 @@ import com.bonus.sgzb.base.service.MaMachineService;
import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
import com.bonus.sgzb.common.log.annotation.Log;
import com.bonus.sgzb.common.log.enums.BusinessType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@ -39,6 +41,7 @@ public class MaMachineController extends BaseController {
/**
* 新增机具设备管理
*/
@Log(title = "新增机具设备管理", businessType = BusinessType.INSERT)
@ApiOperation(value = "新增机具设备管理")
@PostMapping
public AjaxResult maMachineAdd(@Validated @RequestBody MaMachine maMachine)
@ -49,6 +52,7 @@ public class MaMachineController extends BaseController {
/**
* 删除机具设备管理
*/
@Log(title = "删除机具设备管理", businessType = BusinessType.DELETE)
@ApiOperation(value = "删除机具设备管理")
@DeleteMapping("/{maIds}")
public AjaxResult remove(@PathVariable Long[] maIds)
@ -60,6 +64,7 @@ public class MaMachineController extends BaseController {
/**
* 修改机具设备管理
*/
@Log(title = "修改机具设备管理", businessType = BusinessType.UPDATE)
@ApiOperation(value = "修改机具设备管理")
@PutMapping
public AjaxResult edit(@Validated @RequestBody MaMachine maMachine)

View File

@ -1,33 +1,42 @@
package com.bonus.sgzb.base.controller;
import com.bonus.sgzb.base.domain.MaType;
import com.bonus.sgzb.base.service.ITypeService;
import com.bonus.sgzb.common.core.constant.HttpStatus;
import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
import com.bonus.sgzb.common.log.annotation.Log;
import com.bonus.sgzb.common.log.enums.BusinessType;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.stream.Collectors;
/**
* 工机具类型管理控制层
*/
@RestController
@Api(value = "工机具类型管理控制层")
@RequestMapping("/type")
public class MaTypeController extends BaseController {
@Autowired
private ITypeService iTypeService;
/**
* 根据类型名称查询类型
* @return
* @return 结果
*/
@ApiOperation(value = "根据类型名称查询类型")
@GetMapping("/getMaTypeList")
public AjaxResult getMaTypeList(String typeName){
return AjaxResult.success(iTypeService.getMaTypeList(typeName));
}
@ -37,14 +46,67 @@ public class MaTypeController extends BaseController {
* @param typeId
* @return
*/
@GetMapping("/getListByMaType/{typeId}/{typeName}")
public TableDataInfo getListByMaType(@PathVariable("typeId") Long typeId,@PathVariable("typeName") String typeName){
@ApiOperation(value = "根据左列表类型id查询右表格")
@GetMapping("/getListByMaType")
public TableDataInfo getListByMaType(@RequestParam(required = false) Long typeId,
@RequestParam(required = false) String typeName,
@RequestParam(required = false) Integer pageSize,
@RequestParam(required = false) Integer pageNum){
if(typeId==null){
return null;
}
startPage();
return getDataTable(iTypeService.getListByMaType(typeId,typeName));
List<MaType> listByMaType = iTypeService.getListByMaType(typeId, typeName);
TableDataInfo rspData = new TableDataInfo();
rspData.setTotal(listByMaType.size());
rspData.setCode(HttpStatus.SUCCESS);
listByMaType = listByMaType.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
rspData.setRows(listByMaType);
rspData.setMsg("查询成功");
return rspData;
}
/**
* 获取机具类型管理ma_type详细信息
*/
@ApiOperation(value = "获取机具类型管理ma_type详细信息")
@GetMapping(value = "/{typeId}")
public AjaxResult getInfo(@PathVariable("typeId") Long typeId)
{
return success(iTypeService.selectMaTypeByTypeId(typeId));
}
/**
* 新增机具类型管理ma_type
*/
@ApiOperation(value = "新增机具类型管理ma_type")
@Log(title = "机具类型管理ma_type", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MaType maType)
{
return toAjax(iTypeService.insertMaType(maType));
}
/**
* 修改机具类型管理ma_type
*/
@ApiOperation(value = "修改机具类型管理ma_type")
@Log(title = "机具类型管理ma_type", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MaType maType)
{
return toAjax(iTypeService.updateMaType(maType));
}
/**
* 删除机具类型管理ma_type
*/
@ApiOperation(value = "删除机具类型管理ma_type")
@Log(title = "机具类型管理ma_type", businessType = BusinessType.DELETE)
@DeleteMapping("/{typeId}")
public AjaxResult remove(@PathVariable Long typeId)
{
return toAjax(iTypeService.deleteMaTypeByTypeId(typeId));
}

View File

@ -60,6 +60,14 @@ public class MaHouse extends BaseEntity {
@ApiModelProperty(value= "数据所属组织")
private String companyId;
/** 联系人 */
@ApiModelProperty(value= "联系人")
private String concat;
/** 联系电话 */
@ApiModelProperty(value= "联系电话")
private String phone;
/** 数据所属组织 */
@ApiModelProperty(value= "排序")
private int sort;
@ -188,4 +196,20 @@ public class MaHouse extends BaseEntity {
public void setChildren(List<MaHouse> children) {
this.children = children;
}
public String getConcat() {
return concat;
}
public void setConcat(String concat) {
this.concat = concat;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
}

View File

@ -17,6 +17,21 @@ public class MaMachine extends BaseEntity {
*/
@ApiModelProperty(value = "类型ID")
private long typeId;
/**
* 物品种类
*/
@ApiModelProperty(value = "物品种类")
private String itemType;
/**
* 设备类型
*/
@ApiModelProperty(value = "设备类型")
private String deviceType;
/**
* 规格型号
*/
@ApiModelProperty(value = "规格型号")
private String specificationType;
/**
* 机具编号
*/
@ -316,4 +331,27 @@ public class MaMachine extends BaseEntity {
this.companyId = companyId;
}
public String getItemType() {
return itemType;
}
public void setItemType(String itemType) {
this.itemType = itemType;
}
public String getDeviceType() {
return deviceType;
}
public void setDeviceType(String deviceType) {
this.deviceType = deviceType;
}
public String getSpecificationType() {
return specificationType;
}
public void setSpecificationType(String specificationType) {
this.specificationType = specificationType;
}
}

View File

@ -2,8 +2,11 @@ package com.bonus.sgzb.base.domain;
import com.bonus.sgzb.common.core.annotation.Excel;
import com.bonus.sgzb.common.core.web.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 工机具类型管理实体类
@ -13,93 +16,144 @@ public class MaType extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 类型ID */
@Excel(name = "类型ID")
@ApiModelProperty(value = "类型ID")
private Long typeId;
/** 类型名称 */
@Excel(name = "类型名称")
@ApiModelProperty(value = "类型名称")
private String typeName;
/** 上级ID */
@Excel(name = "上级ID")
@ApiModelProperty(value = "上级ID")
private Long parentId;
/** 帐号状态0正常 1停用 */
@Excel(name = "帐号状态0正常 1停用")
@ApiModelProperty(value = "帐号状态0正常 1停用")
private String status;
/** 实时库存 */
@Excel(name = "实时库存")
@ApiModelProperty(value = "实时库存")
private String num;
/** 计量单位id */
@Excel(name = "计量单位id")
@ApiModelProperty(value = "计量单位id")
private String unitId;
/** 管理方式 */
@Excel(name = "管理方式")
@ApiModelProperty(value = "管理方式")
private String manageType;
/** 租赁单价 */
@Excel(name = "租赁单价")
@ApiModelProperty(value = "租赁单价")
private String leasePrice;
/** 原价 */
@Excel(name = "原价")
@ApiModelProperty(value = "原价")
private String buyPrice;
/** 丢失赔偿价 */
@Excel(name = "丢失赔偿价")
@ApiModelProperty(value = "丢失赔偿价")
private String payPrice;
/** 层级 */
@Excel(name = "层级")
@ApiModelProperty(value = "层级")
private String level;
/** 额定载荷 */
@Excel(name = "额定载荷")
@ApiModelProperty(value = "额定载荷")
private String ratedLoad;
/** 试验载荷 */
@Excel(name = "试验载荷")
@ApiModelProperty(value = "试验载荷")
private String testLoad;
/** 持荷时间 */
@Excel(name = "持荷时间")
@ApiModelProperty(value = "持荷时间")
private String holdingTime;
/** 库存预警数量 */
@Excel(name = "库存预警数量")
@ApiModelProperty(value = "库存预警数量")
private String warnNum;
/** 库存预警数量 */
@ApiModelProperty(value = "是否计划管理0代表否 1代表是")
private String isPlan;
/** 库存预警数量 */
@ApiModelProperty(value = "是否安措费机具0代表否1代表是")
private String isAncuo;
/** 删除标志0代表存在 2代表删除 */
@Excel(name = "删除标志0代表存在 2代表删除")
@ApiModelProperty(value = "删除标志0代表存在 2代表删除")
private String delFlag;
/** 创建者 */
@Excel(name = "创建者")
@ApiModelProperty(value = "创建者")
private String createBy;
/** 创建时间 */
@Excel(name = "创建时间")
@ApiModelProperty(value = "创建时间")
private Date createTime;
/** 更新者 */
@Excel(name = "更新者")
@ApiModelProperty(value = "更新者")
private String updateBy;
/** 更新时间 */
@Excel(name = "更新时间")
@ApiModelProperty(value = "更新时间")
private Date updateTime;
/** 备注 */
@Excel(name = "备注")
@ApiModelProperty(value = "备注")
private String remark;
/** 数据所属组织 */
@Excel(name = "数据所属组织")
@ApiModelProperty(value = "数据所属组织")
private String companyId;
/** 图片名称 */
@ApiModelProperty(value = "图片名称")
private String photoName;
/** 图片路径 */
@ApiModelProperty(value = "图片路径")
private String photoUrl;
/** 文档名称 */
@ApiModelProperty(value = "文档名称")
private String documentName;
/** 文档路径 */
@ApiModelProperty(value = "文档路径")
private String documentUrl;
/** 库管员id */
@ApiModelProperty(value = "库管员id")
private long keeperUserId;
/** 库管员名称 */
@ApiModelProperty(value = "库管员名称")
private String keeperUserName;
/** 库管员id */
@ApiModelProperty(value = "维修员id")
private long repairUserId;
/** 维修员名称 */
@ApiModelProperty(value = "维修员名称")
private String repairUserName;
/** 资产属性id */
@ApiModelProperty(value = "资产属性id")
private long propId;
/** 资产属性名称 */
@ApiModelProperty(value = "资产属性名称")
private String propName;
private List<MaType> children = new ArrayList<>();
public Long getTypeId() {
return typeId;
}
@ -285,4 +339,108 @@ public class MaType extends BaseEntity {
public void setCompanyId(String companyId) {
this.companyId = companyId;
}
public String getPhotoName() {
return photoName;
}
public void setPhotoName(String photoName) {
this.photoName = photoName;
}
public String getPhotoUrl() {
return photoUrl;
}
public void setPhotoUrl(String photoUrl) {
this.photoUrl = photoUrl;
}
public String getDocumentName() {
return documentName;
}
public void setDocumentName(String documentName) {
this.documentName = documentName;
}
public String getDocumentUrl() {
return documentUrl;
}
public void setDocumentUrl(String documentUrl) {
this.documentUrl = documentUrl;
}
public String getIsPlan() {
return isPlan;
}
public void setIsPlan(String isPlan) {
this.isPlan = isPlan;
}
public String getIsAncuo() {
return isAncuo;
}
public void setIsAncuo(String isAncuo) {
this.isAncuo = isAncuo;
}
public long getKeeperUserId() {
return keeperUserId;
}
public void setKeeperUserId(long keeperUserId) {
this.keeperUserId = keeperUserId;
}
public String getKeeperUserName() {
return keeperUserName;
}
public void setKeeperUserName(String keeperUserName) {
this.keeperUserName = keeperUserName;
}
public long getRepairUserId() {
return repairUserId;
}
public void setRepairUserId(long repairUserId) {
this.repairUserId = repairUserId;
}
public String getRepairUserName() {
return repairUserName;
}
public void setRepairUserName(String repairUserName) {
this.repairUserName = repairUserName;
}
public long getPropId() {
return propId;
}
public void setPropId(long propId) {
this.propId = propId;
}
public String getPropName() {
return propName;
}
public void setPropName(String propName) {
this.propName = propName;
}
public List<MaType> getChildren() {
return children;
}
public void setChildren(List<MaType> children) {
this.children = children;
}
}

View File

@ -30,5 +30,36 @@ public class MaTypeKeeper extends BaseEntity {
@Excel(name = "数据所属组织")
private String companyId;
public Long getTypeId() {
return typeId;
}
public void setTypeId(Long typeId) {
this.typeId = typeId;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getCompanyId() {
return companyId;
}
public void setCompanyId(String companyId) {
this.companyId = companyId;
}
}

View File

@ -0,0 +1,79 @@
package com.bonus.sgzb.base.domain;
import com.bonus.sgzb.common.core.annotation.Excel;
import com.bonus.sgzb.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 维修班机具配置ma_type_repair对象 ma_type_repair
*
* @author bonus
* @date 2023-12-11
*/
public class MaTypeRepair extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 类型ID */
private Long typeId;
/** 用户 */
@Excel(name = "用户")
private Long userId;
/** 创建时间 */
@Excel(name = "创建时间")
private String time;
/** 数据所属组织 */
@Excel(name = "数据所属组织")
private String companyId;
public void setTypeId(Long typeId)
{
this.typeId = typeId;
}
public Long getTypeId()
{
return typeId;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setTime(String time)
{
this.time = time;
}
public String getTime()
{
return time;
}
public void setCompanyId(String companyId)
{
this.companyId = companyId;
}
public String getCompanyId()
{
return companyId;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("typeId", getTypeId())
.append("userId", getUserId())
.append("time", getTime())
.append("companyId", getCompanyId())
.toString();
}
}

View File

@ -1,6 +1,7 @@
package com.bonus.sgzb.base.domain.vo;
import com.bonus.sgzb.base.domain.MaHouse;
import com.bonus.sgzb.base.domain.MaType;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
@ -38,6 +39,13 @@ public class TreeSelect implements Serializable
this.children = maHouse.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
}
public TreeSelect(MaType maType)
{
this.id = maType.getTypeId();
this.label = maType.getTypeName();
this.children = maType.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
}
public Long getId()
{
return id;

View File

@ -70,4 +70,6 @@ public interface MaHouseMapper {
List<MaHouse> selectHouse();
List<MaHouse> selectHouseParent(@Param("parentId") long parentId);
MaHouse selectMaHouseByHouseId(Long houseId);
}

View File

@ -12,4 +12,6 @@ public interface MaHouseSetMapper {
public int deleteHouseSetById(Long id);
public int updateHouseSet(MaHouseSet maHouseSet);
MaHouseSet selectMaHouseSetByHouseId(Long id);
}

View File

@ -1,18 +0,0 @@
package com.bonus.sgzb.base.mapper;
import com.bonus.sgzb.base.domain.MaHouseShel;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* MaHouseShelMapper
* @Author dingjie
* @Date 2023-12-07
**/
@Mapper
public interface MaHouseShelMapper{
List<MaHouseShel> selectHouseShelList(MaHouseShel houseShel);
}

View File

@ -0,0 +1,62 @@
package com.bonus.sgzb.base.mapper;
import com.bonus.sgzb.base.domain.MaTypeFile;
import java.util.List;
/**
* 机具类型文件ma_type_fileMapper接口
*
* @author bonus
* @date 2023-12-11
*/
public interface MaTypeFileMapper
{
/**
* 查询机具类型文件ma_type_file
*
* @param typeId 机具类型文件ma_type_file主键
* @return 机具类型文件ma_type_file
*/
public MaTypeFile selectMaTypeFileByTypeId(Long typeId);
/**
* 查询机具类型文件ma_type_file列表
*
* @param maTypeFile 机具类型文件ma_type_file
* @return 机具类型文件ma_type_file集合
*/
public List<MaTypeFile> selectMaTypeFileList(MaTypeFile maTypeFile);
/**
* 新增机具类型文件ma_type_file
*
* @param maTypeFile 机具类型文件ma_type_file
* @return 结果
*/
public int insertMaTypeFile(MaTypeFile maTypeFile);
/**
* 修改机具类型文件ma_type_file
*
* @param maTypeFile 机具类型文件ma_type_file
* @return 结果
*/
public int updateMaTypeFile(MaTypeFile maTypeFile);
/**
* 删除机具类型文件ma_type_file
*
* @param typeId 机具类型文件ma_type_file主键
* @return 结果
*/
public int deleteMaTypeFileByTypeId(Long typeId);
/**
* 批量删除机具类型文件ma_type_file
*
* @param typeIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteMaTypeFileByTypeIds(Long[] typeIds);
}

View File

@ -1,6 +1,9 @@
package com.bonus.sgzb.base.mapper;
import com.bonus.sgzb.base.domain.MaPropSet;
import com.bonus.sgzb.base.domain.MaType;
import com.bonus.sgzb.base.domain.MaTypeKeeper;
import com.bonus.sgzb.base.domain.MaTypeRepair;
import java.util.List;
@ -13,5 +16,52 @@ public interface MaTypeMapper
{
List<MaType> selectMaTypeList();
List<MaType> selectMaTypeList(String typeName);
/**
* 查询机具类型管理ma_type
*
* @param typeId 机具类型管理ma_type主键
* @return 机具类型管理ma_type
*/
public MaType selectMaTypeByTypeId(Long typeId);
/**
* 新增机具类型管理ma_type
*
* @param maType 机具类型管理ma_type
* @return 结果
*/
public int insertType(MaType maType);
/**
* 修改机具类型管理ma_type
*
* @param maType 机具类型管理ma_type
* @return 结果
*/
public int updateType(MaType maType);
/**
* 删除机具类型管理ma_type
*
* @param typeId 机具类型管理ma_type主键
* @return 结果
*/
public int deleteTypeById(Long typeId);
int insertKeeper(MaTypeKeeper typeKeeper);
int insertRepair(MaTypeRepair typeRepair);
int insertMaPropSet(MaPropSet propSet);
int updateKeeperByTypeId(MaTypeKeeper typeKeeper);
int updateRepairByTypeId(MaTypeRepair typeRepair);
int updatePropSetByTypeId(MaPropSet propSet);
MaType selectTypeByTypeId(long typeId);
}

View File

@ -1,6 +1,8 @@
package com.bonus.sgzb.base.service;
import com.bonus.sgzb.base.domain.MaHouse;
import com.bonus.sgzb.base.domain.MaType;
import com.bonus.sgzb.base.domain.vo.TreeSelect;
import java.util.List;
@ -9,8 +11,58 @@ import java.util.List;
*/
public interface ITypeService {
List<MaType> getMaTypeList(String typeName);
List<TreeSelect> getMaTypeList(String typeName);
List<MaType> getListByMaType(Long typeId,String typeName);
/**
* 查询机具类型管理ma_type
*
* @param typeId 机具类型管理ma_type主键
* @return 机具类型管理ma_type
*/
public MaType selectMaTypeByTypeId(Long typeId);
/**
* 新增机具类型管理ma_type
*
* @param maType 机具类型管理ma_type
* @return 结果
*/
public int insertMaType(MaType maType);
/**
* 修改机具类型管理ma_type
*
* @param maType 机具类型管理ma_type
* @return 结果
*/
public int updateMaType(MaType maType);
/**
* 删除机具类型管理ma_type信息
*
* @param typeId 机具类型管理ma_type主键
* @return 结果
*/
public int deleteMaTypeByTypeId(Long typeId);
/**
* 构建前端所需要树结构
*
* @param maTypeList 状态列表
* @return 树结构列表
*/
public List<MaType> buildDeptTree(List<MaType> maTypeList);
/**
* 构建前端所需要下拉树结构
*
* @param maTypeList 工机具列表
* @return 下拉树结构列表
*/
public List<TreeSelect> buildDeptTreeSelect(List<MaType> maTypeList);
}

View File

@ -74,4 +74,12 @@ public interface IhouseService {
* @return 树结构列表
*/
public List<MaHouse> buildDeptTree(List<MaHouse> maHouseList);
/**
* 查询仓库管理ma_house_info
*
* @param houseId 仓库管理ma_house_info主键
* @return 仓库管理ma_house_info
*/
public MaHouse selectMaHouseByHouseId(Long houseId);
}

View File

@ -13,4 +13,6 @@ public interface MaHouseSetService {
public int deleteHouseSetById(Long id);
public int updateHouseSet(MaHouseSet maHouseSet);
MaHouseSet selectMaHouseSetByHouseId(Long id);
}

View File

@ -1,18 +0,0 @@
package com.bonus.sgzb.base.service;
import com.bonus.sgzb.base.domain.MaHouseShel;
import java.util.List;
/**
* MaHouseShelService
* @Author dingjie
* @Date 2023-12-07
**/
public interface MaHouseShelService{
List<MaHouseShel> selectHouseShelList(MaHouseShel houseShel);
int insertHouseShel(MaHouseShel houseShel);
}

View File

@ -25,6 +25,20 @@ public class MaHouseServiceImpl implements IhouseService {
@Resource
private MaHouseMapper houseMapper;
/**
* 查询仓库管理ma_house_info
*
* @param houseId 仓库管理ma_house_info主键
* @return 仓库管理ma_house_info
*/
@Override
public MaHouse selectMaHouseByHouseId(Long houseId)
{
return houseMapper.selectMaHouseByHouseId(houseId);
}
/**
* 校验工程项目名称
*

View File

@ -33,4 +33,16 @@ public class MaHouseSetImpl implements MaHouseSetService {
public int updateHouseSet(MaHouseSet maHouseSet) {
return maHouseSetMapper.updateHouseSet(maHouseSet);
}
/**
* 查询仓库货架配置ma_house_set
*
* @param id 仓库货架配置ma_house_set主键
* @return 仓库货架配置ma_house_set
*/
@Override
public MaHouseSet selectMaHouseSetByHouseId(Long id)
{
return maHouseSetMapper.selectMaHouseSetByHouseId(id);
}
}

View File

@ -1,46 +0,0 @@
package com.bonus.sgzb.base.service.impl;
import com.bonus.sgzb.base.domain.MaHouseShel;
import com.bonus.sgzb.base.mapper.MaHouseShelMapper;
import com.bonus.sgzb.base.service.MaHouseShelService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
/**
* MaHouseShelServiceImpl
* @Author dingjie
* @Date 2023-12-07
**/
@Service
@Transactional(rollbackFor = Exception.class)
public class MaHouseShelServiceImpl implements MaHouseShelService {
@Resource
private MaHouseShelMapper houseShelMapper;
/**
* 根据查询条件筛选仓库货架
* @param houseShel 仓库货架信息
* @return 结果
*/
@Override
public List<MaHouseShel> selectHouseShelList(MaHouseShel houseShel) {
List<MaHouseShel> houseShelList = houseShelMapper.selectHouseShelList(houseShel);
return null;
}
/**
* 新增仓库货架
* @param houseShel 仓库货架信息
* @return 结果
*/
@Override
public int insertHouseShel(MaHouseShel houseShel) {
return 0;
}
}

View File

@ -1,23 +1,52 @@
package com.bonus.sgzb.base.service.impl;
import com.bonus.sgzb.base.domain.MaMachine;
import com.bonus.sgzb.base.domain.MaType;
import com.bonus.sgzb.base.mapper.MaMachineMapper;
import com.bonus.sgzb.base.mapper.MaTypeMapper;
import com.bonus.sgzb.base.service.MaMachineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class MaMachineServiceImpl implements MaMachineService {
@Autowired
@Resource
private MaMachineMapper maMachineMapper;
@Resource
private MaTypeMapper typeMapper;
@Override
public List<MaMachine> getMaMachine(MaMachine maMachine) {
return maMachineMapper.getMaMachine(maMachine);
List<MaMachine> maMachineList = maMachineMapper.getMaMachine(maMachine);
for (MaMachine machine : maMachineList) {
// 添加查询物品种类,设备类型,规格型号
getType(machine);
}
return maMachineList;
}
/**
* 添加查询物品种类,设备类型,规格型号
* @param machine
* @return
*/
private void getType(MaMachine machine) {
long typeId = machine.getTypeId();
// 规格型号
MaType maType = typeMapper.selectTypeByTypeId(typeId);
// 设备类型
machine.setSpecificationType(maType.getTypeName());
MaType maType1 = typeMapper.selectTypeByTypeId(maType.getParentId());
// 物品种类
machine.setDeviceType(maType1.getTypeName());
MaType maType2 = typeMapper.selectTypeByTypeId(maType1.getParentId());
machine.setItemType(maType2.getTypeName());
}
@Override

View File

@ -1,15 +1,18 @@
package com.bonus.sgzb.base.service.impl;
import com.bonus.sgzb.base.domain.MaType;
import com.bonus.sgzb.base.domain.*;
import com.bonus.sgzb.base.domain.vo.TreeSelect;
import com.bonus.sgzb.base.mapper.MaTypeFileMapper;
import com.bonus.sgzb.base.mapper.MaTypeMapper;
import com.bonus.sgzb.base.service.ITypeService;
import com.bonus.sgzb.common.core.utils.DateUtils;
import com.bonus.sgzb.common.core.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -18,69 +21,176 @@ import java.util.stream.Collectors;
@Service
public class MaTypeServiceImpl implements ITypeService {
@Autowired
@Resource
private MaTypeMapper maTypeMapper;
@Resource
private MaTypeFileMapper typeFileMapper;
/**
* 查询机具类型管理ma_type
*
* @param typeId 机具类型管理ma_type主键
* @return 机具类型管理ma_type
*/
@Override
public List<MaType> getMaTypeList(String typeName) {
public MaType selectMaTypeByTypeId(Long typeId) {
return maTypeMapper.selectMaTypeByTypeId(typeId);
}
List<MaType> maTypes = maTypeMapper.selectMaTypeList();
if(StringUtils.isNotNull(typeName)){
//根据类型名称过滤集合
List<MaType> types = maTypes
.stream()
.filter(maType -> maType.getTypeName().contains(typeName))
.collect(Collectors.toList());
//如果没有查询到那么返回空
if(types.size()==0){
return null;
}
//递归获取树
return getTypeListByMaType(Collections.singletonList(types.get(0)),maTypes,null);
/**
* 新增机具类型管理ma_type
*
* @param maType 机具类型管理ma_type
* @return 结果
*/
@Override
@Transactional
public int insertMaType(MaType maType) {
maType.setCreateTime(DateUtils.getNowDate());
int i = maTypeMapper.insertType(maType);
Long typeId = maType.getTypeId();
// 图片路径保存
MaTypeFile typeFile = new MaTypeFile();
typeFile.setTypeId(typeId);
typeFile.setFileName(maType.getPhotoName());
typeFile.setFileUrl(maType.getPhotoUrl());
typeFile.setFileType("");
typeFileMapper.insertMaTypeFile(typeFile);
// 文档路径保存
MaTypeFile typeFile1 = new MaTypeFile();
typeFile1.setTypeId(typeId);
typeFile1.setFileName(maType.getDocumentName());
typeFile1.setFileUrl(maType.getDocumentUrl());
typeFile1.setFileType("");
typeFileMapper.insertMaTypeFile(typeFile1);
// 库管员配置
MaTypeKeeper typeKeeper = new MaTypeKeeper();
typeKeeper.setUserId(maType.getKeeperUserId());
typeKeeper.setTypeId(typeId);
maTypeMapper.insertKeeper(typeKeeper);
// 维修员配置
MaTypeRepair typeRepair = new MaTypeRepair();
typeRepair.setUserId(maType.getRepairUserId());
typeRepair.setTypeId(typeId);
maTypeMapper.insertRepair(typeRepair);
// 资产属性配置
MaPropSet propSet = new MaPropSet();
propSet.setTypeId(typeId);
propSet.setPropId(maType.getPropId());
maTypeMapper.insertMaPropSet(propSet);
return i;
}
/**
* 修改机具类型管理ma_type
*
* @param maType 机具类型管理ma_type
* @return 结果
*/
@Override
public int updateMaType(MaType maType) {
Long typeId = maType.getTypeId();
maType.setUpdateTime(DateUtils.getNowDate());
int i = maTypeMapper.updateType(maType);
// 图片路径保存
if (StringUtils.isNotEmpty(maType.getPhotoName()) && StringUtils.isNotEmpty(maType.getPhotoUrl())) {
MaTypeFile typeFile = new MaTypeFile();
typeFile.setTypeId(typeId);
typeFile.setFileName(maType.getPhotoName());
typeFile.setFileUrl(maType.getPhotoUrl());
typeFile.setFileType("1");
typeFileMapper.updateMaTypeFile(typeFile);
}
return maTypes;
// 文档路径保存
if (StringUtils.isNotEmpty(maType.getDocumentName()) && StringUtils.isNotEmpty(maType.getDocumentUrl())) {
MaTypeFile typeFile1 = new MaTypeFile();
typeFile1.setTypeId(typeId);
typeFile1.setFileName(maType.getDocumentName());
typeFile1.setFileUrl(maType.getDocumentUrl());
typeFile1.setFileType("2");
typeFileMapper.updateMaTypeFile(typeFile1);
}
// 库管员配置
if (maType.getKeeperUserId() >= 0L) {
MaTypeKeeper typeKeeper = new MaTypeKeeper();
typeKeeper.setUserId(maType.getKeeperUserId());
typeKeeper.setTypeId(typeId);
maTypeMapper.updateKeeperByTypeId(typeKeeper);
}
// 维修员配置
if (maType.getRepairUserId() >= 0L) {
MaTypeRepair typeRepair = new MaTypeRepair();
typeRepair.setUserId(maType.getRepairUserId());
typeRepair.setTypeId(typeId);
maTypeMapper.updateRepairByTypeId(typeRepair);
}
// 资产属性配置
if (maType.getPropId() >= 0L) {
MaPropSet propSet = new MaPropSet();
propSet.setTypeId(typeId);
propSet.setPropId(maType.getPropId());
maTypeMapper.updatePropSetByTypeId(propSet);
}
return i;
}
/**
* 删除机具类型管理ma_type信息
*
* @param typeId 机具类型管理ma_type主键
* @return 结果
*/
@Override
public int deleteMaTypeByTypeId(Long typeId) {
return maTypeMapper.deleteTypeById(typeId);
}
@Override
public List<TreeSelect> getMaTypeList(String typeName) {
List<MaType> maTypes = maTypeMapper.selectMaTypeList(typeName);
//如果没有查询到那么返回空
return buildDeptTreeSelect(maTypes);
}
/**
* 根据左列表类型id查询右表格
*
* @param typeId
* @return
*/
@Override
public List<MaType> getListByMaType(Long typeId, String typeName) {
List<MaType> maTypes = maTypeMapper.selectMaTypeList();
List<MaType> maTypes = maTypeMapper.selectMaTypeList("");
MaType maType = new MaType();
maType.setTypeId(typeId);
List<MaType> typeListByMaType = getTypeListByMaType(Collections.singletonList(maType), maTypes, new ArrayList<>());
if(StringUtils.isNotNull(typeName)){
if (StringUtils.isNotNull(typeName)) {
//根据类型名称过滤集合
List<MaType> types = typeListByMaType
.stream()
.filter(ma -> ma.getTypeName().contains(typeName))
.collect(Collectors.toList());
//如果没有查询到那么返回空
if(types.size()==0){
return null;
}
//递归获取树
return getTypeListByMaType(Collections.singletonList(types.get(0)),maTypes,null);
return types;
}
return typeListByMaType;
}
/**
* 根据父级类型递归获取树结构
*
* @param
* @return
*/
private List<MaType> getTypeListByMaType(List<MaType> parentTypes,List<MaType> oldMaTypes,List<MaType> newMaTypes) {
private List<MaType> getTypeListByMaType(List<MaType> parentTypes, List<MaType> oldMaTypes, List<MaType> newMaTypes) {
//初始化新容器
if(newMaTypes==null){
if (newMaTypes == null) {
newMaTypes = new ArrayList<>();
//添加父级对象 左边需要添加因为需要显示 右边不需要添加因为不需要显示
newMaTypes.addAll(parentTypes);
@ -88,21 +198,125 @@ public class MaTypeServiceImpl implements ITypeService {
//递归父级容器
List<MaType> parentList = new ArrayList<>();
//过滤相同数据,减少循环,性能优化
oldMaTypes = oldMaTypes.stream().filter(oldMaType->!parentTypes.contains(oldMaType)).collect(Collectors.toList());
oldMaTypes = oldMaTypes.stream().filter(oldMaType -> !parentTypes.contains(oldMaType)).collect(Collectors.toList());
for (MaType maType : oldMaTypes) {
for (MaType parentType : parentTypes) {
if(maType.getParentId().equals(parentType.getTypeId())){
if (maType.getParentId().equals(parentType.getTypeId())) {
newMaTypes.add(maType);
parentList.add(maType);
}
}
}
//如果还有父级递归查询
if(parentList.size()>0){
return getTypeListByMaType(parentList,oldMaTypes,newMaTypes);
}else{
if (parentList.size() > 0) {
return getTypeListByMaType(parentList, oldMaTypes, newMaTypes);
} else {
List<MaType> result = new ArrayList<>();
for (MaType type : newMaTypes) {
boolean a = true;
Long typeId1 = type.getTypeId();
for (MaType type1 : newMaTypes) {
Long pid = type1.getParentId();
if (typeId1.equals(pid)) {
a = false;
}
}
if (a) {
result.add(type);
}
}
//返回
return newMaTypes;
return result;
}
}
/**
* 构建前端所需要树结构
*
* @param maTypeList 部门列表
* @return 树结构列表
*/
@Override
public List<MaType> buildDeptTree(List<MaType> maTypeList)
{
List<MaType> returnList = new ArrayList<MaType>();
List<Long> tempList = maTypeList.stream().map(MaType::getTypeId).collect(Collectors.toList());
for (MaType maType : maTypeList)
{
// 如果是顶级节点, 遍历该父节点的所有子节点
if (!tempList.contains(maType.getParentId()))
{
recursionFn(maTypeList, maType);
returnList.add(maType);
}
}
if (returnList.isEmpty())
{
returnList = maTypeList;
}
return returnList;
}
/**
* 构建前端所需要下拉树结构
*
* @param depts 部门列表
* @return 下拉树结构列表
*/
@Override
public List<TreeSelect> buildDeptTreeSelect(List<MaType> depts)
{
List<MaType> deptTrees = buildDeptTree(depts);
return deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList());
}
/**
* 递归列表
*/
private void recursionFn(List<MaType> list, MaType t)
{
// 得到子节点列表
List<MaType> childList = getChildList(list, t);
t.setChildren(childList);
for (MaType tChild : childList)
{
if (hasChild(list, tChild))
{
recursionFn(list, tChild);
}
}
}
/**
* 得到子节点列表
*/
private List<MaType> getChildList(List<MaType> list, MaType t)
{
List<MaType> tlist = new ArrayList<MaType>();
Iterator<MaType> it = list.iterator();
while (it.hasNext())
{
MaType n = (MaType) it.next();
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getTypeId().longValue())
{
tlist.add(n);
}
}
return tlist;
}
/**
* 判断是否有子节点
*/
private boolean hasChild(List<MaType> list, MaType t)
{
return getChildList(list, t).size() > 0 ? true : false;
}
}

View File

@ -18,10 +18,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="remark" column="remark" />
<result property="companyId" column="company_id" />
<result property="sort" column="sort" />
<result property="concat" column="concat" />
<result property="phone" column="phone" />
</resultMap>
<sql id="selectHouseVo">
select house_id, house_name, parent_id, status, dept_id, del_flag, create_by, create_time, remark, company_id, sort
select house_id, house_name, parent_id, status, dept_id, del_flag, create_by, create_time, remark, company_id,phone ,concat
from ma_house_info
</sql>
@ -36,6 +38,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="companyId != null and companyId != ''">company_id,</if>
<if test="concat != null and concat != ''">concat,</if>
<if test="phone != null and phone != ''">phone,</if>
create_time
)values(
<if test="houseId != null and houseId != 0">#{houseId},</if>
@ -47,6 +51,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="companyId != null and companyId != ''">#{companyId},</if>
<if test="concat != null and concat != ''">#{concat},</if>
<if test="phone != null and phone != ''">#{phone},</if>
sysdate()
)
</insert>
@ -62,6 +68,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="companyId != null and companyId != ''">company_id = #{companyId},</if>
<if test="concat != null and concat != ''">concat = #{concat},</if>
<if test="phone != null and phone != ''">phone = #{phone},</if>
update_time = sysdate()
</set>
where house_id = #{houseId}
@ -73,7 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectHouseList" parameterType="com.bonus.sgzb.base.domain.MaHouse" resultMap="SysHouseResult">
select house_id, house_name, parent_id, status, dept_id, del_flag, create_by, create_time, remark, company_id, sort
select house_id, house_name, parent_id, status, dept_id, del_flag, create_by, create_time, remark, company_id, sort,concat,phone
from ma_house_info
<where>
<if test="houseName != null and houseName != ''">
@ -106,4 +114,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectHouseVo"/>
where house_name=#{houseName} limit 1
</select>
<select id="selectMaHouseByHouseId" parameterType="Long" resultMap="SysHouseResult">
<include refid="selectHouseVo"/>
where house_id = #{houseId}
</select>
</mapper>

View File

@ -26,6 +26,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from ma_house_set
</sql>
<select id="selectMaHouseSetByHouseId" parameterType="Long" resultMap="SysHouseSetResult">
<include refid="selectHouseSetVo"/>
where id = #{id}
</select>
<insert id="maHouseSetAdd" parameterType="com.bonus.sgzb.base.domain.MaHouseSet" >
insert into ma_house_set(
<if test="houseId != null and houseId != 0">house_id,</if>

View File

@ -1,36 +0,0 @@
<?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.sgzb.base.mapper.MaHouseShelMapper">
<resultMap id="BaseResultMap" type="com.bonus.sgzb.base.domain.MaHouseShel">
<id column="shelve_id" property="shelveId" jdbcType="BIGINT"/>
<result column="shelve_name" property="shelveName" jdbcType="VARCHAR"/>
<result column="parent_id" property="parentId" jdbcType="BIGINT"/>
<result column="contact" property="contact" jdbcType="VARCHAR"/>
<result column="sort" property="sort" jdbcType="INTEGER"/>
<result column="contact_phone" property="contactPhone" jdbcType="VARCHAR"/>
<result column="remark" property="remark" jdbcType="VARCHAR"/>
<result column="status" property="status" jdbcType="VARCHAR"/>
<result column="del_flag" property="delFlag" jdbcType="VARCHAR"/>
<result column="create_by" property="createBy" jdbcType="VARCHAR"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_by" property="updateBy" jdbcType="VARCHAR"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
<result column="company_id" property="companyId" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
shelve_id, shelve_name, parent_id, contact, sort, contact_phone, remark, status, del_flag, create_by, create_time, update_by, update_time, company_id
</sql>
<select id="selectHouseShelList" resultMap="BaseResultMap">
<include refid="Base_Column_List"/>
from ma_house_shell
<where>
<if test="shelveName != null and shelveName != ''">
and shelve_name like concat('%', #{shelveName}, '%')
</if>
</where>
</select>
</mapper>

View File

@ -3,6 +3,32 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.sgzb.base.mapper.MaTypeMapper">
<resultMap type="com.bonus.sgzb.base.domain.MaType" id="MaTypeResult">
<result property="typeId" column="type_id" />
<result property="typeName" column="type_name" />
<result property="parentId" column="parent_id" />
<result property="status" column="status" />
<result property="num" column="num" />
<result property="unitId" column="unit_id" />
<result property="manageType" column="manage_type" />
<result property="leasePrice" column="lease_price" />
<result property="buyPrice" column="buy_price" />
<result property="payPrice" column="pay_price" />
<result property="level" column="level" />
<result property="ratedLoad" column="rated_load" />
<result property="testLoad" column="test_load" />
<result property="holdingTime" column="holding_time" />
<result property="warnNum" column="warn_num" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="isPlan" column="is_plan" />
<result property="isAncuo" column="is_ancuo" />
<result property="remark" column="remark" />
<result property="companyId" column="company_id" />
</resultMap>
<sql id="selectMaTypeVo">
select type_id, type_name, parent_id, status, num, unit_id, manage_type, lease_price, buy_price, pay_price, level, rated_load, test_load, holding_time, warn_num, del_flag, create_by, create_time, remark, company_id
@ -10,37 +36,57 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<insert id="insertType" parameterType="com.bonus.sgzb.base.domain.MaType" useGeneratedKeys="true" keyProperty="typeId">
insert into ma_type(
<if test="typeId != null and typeId != 0">type_id,</if>
<if test="typeName != null and typeName != ''">type_name,</if>
<if test="parentId != null and parentId != 0">parent_id,</if>
<if test="status != null and status != ''">status,</if>
<if test="num != null and num != 0">num,</if>
<if test="unitId != null and unitId != 0">unit_id,</if>
<if test="manageType != null and manageType != 0">manage_type,</if>
<if test="leasePrice != null and leasePrice != 0">lease_price,</if>
<if test="buyPrice != null and buyPrice != 0">buy_price,</if>
<if test="payPrice != null and payPrice != 0">pay_price,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="companyId != null and companyId != ''">company_id,</if>
create_time
)values(
<if test="typeId != null and typeId != 0">#{typeId},</if>
<if test="typeName != null and typeName != ''">#{typeName},</if>
<if test="parentId != null and parentId != 0">#{parentId},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="num != null and num != ''">#{num},</if>
<if test="unitId != null and unitId != 0">#{unitId},</if>
<if test="manageType != null and manageType != ''">#{manageType},</if>
<if test="leasePrice != null and leasePrice != ''">#{leasePrice},</if>
<if test="buyPrice != null and buyPrice != ''">#{buyPrice},</if>
<if test="payPrice != null and payPrice != ''">#{payPrice},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="companyId != null and companyId != ''">#{companyId},</if>
sysdate()
)
insert into ma_type
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="typeName != null and typeName != ''">type_name,</if>
<if test="parentId != null">parent_id,</if>
<if test="status != null">status,</if>
<if test="num != null">num,</if>
<if test="unitId != null">unit_id,</if>
<if test="manageType != null">manage_type,</if>
<if test="leasePrice != null">lease_price,</if>
<if test="buyPrice != null">buy_price,</if>
<if test="payPrice != null">pay_price,</if>
<if test="level != null">level,</if>
<if test="ratedLoad != null">rated_load,</if>
<if test="testLoad != null">test_load,</if>
<if test="holdingTime != null">holding_time,</if>
<if test="warnNum != null">warn_num,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="isPlan != null">is_plan,</if>
<if test="isAncuo != null">is_ancuo,</if>
<if test="remark != null">remark,</if>
<if test="companyId != null">company_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="typeName != null and typeName != ''">#{typeName},</if>
<if test="parentId != null">#{parentId},</if>
<if test="status != null">#{status},</if>
<if test="num != null">#{num},</if>
<if test="unitId != null">#{unitId},</if>
<if test="manageType != null">#{manageType},</if>
<if test="leasePrice != null">#{leasePrice},</if>
<if test="buyPrice != null">#{buyPrice},</if>
<if test="payPrice != null">#{payPrice},</if>
<if test="level != null">#{level},</if>
<if test="ratedLoad != null">#{ratedLoad},</if>
<if test="testLoad != null">#{testLoad},</if>
<if test="holdingTime != null">#{holdingTime},</if>
<if test="warnNum != null">#{warnNum},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="isPlan != null">#{isPlan},</if>
<if test="isAncuo != null">#{isAncuo},</if>
<if test="remark != null">#{remark},</if>
<if test="companyId != null">#{companyId},</if>
</trim>
</insert>
<insert id="insertTypeFile" parameterType="com.bonus.sgzb.base.domain.MaTypeFile" useGeneratedKeys="true" keyProperty="typeId">
@ -69,21 +115,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateType">
update ma_type
<set>
<trim prefix="SET" suffixOverrides=",">
<if test="typeName != null and typeName != ''">type_name = #{typeName},</if>
<if test="parentId != null and parentId != ''">parent_id = #{parentId},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="num != null and num != ''">num = #{num},</if>
<if test="unitId != null and unitId != ''">unit_id = #{unitId},</if>
<if test="manageType != null and manageType != ''">manage_type = #{manageType},</if>
<if test="leasePrice != null and leasePrice != ''">lease_price = #{leasePrice},</if>
<if test="buyPrice != null and buyPrice != ''">buy_price = #{buyPrice},</if>
<if test="payPrice != null and payPrice != ''">pay_price = #{payPrice},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="status != null">status = #{status},</if>
<if test="num != null">num = #{num},</if>
<if test="unitId != null">unit_id = #{unitId},</if>
<if test="manageType != null">manage_type = #{manageType},</if>
<if test="leasePrice != null">lease_price = #{leasePrice},</if>
<if test="buyPrice != null">buy_price = #{buyPrice},</if>
<if test="payPrice != null">pay_price = #{payPrice},</if>
<if test="level != null">level = #{level},</if>
<if test="ratedLoad != null">rated_load = #{ratedLoad},</if>
<if test="testLoad != null">test_load = #{testLoad},</if>
<if test="holdingTime != null">holding_time = #{holdingTime},</if>
<if test="warnNum != null">warn_num = #{warnNum},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="isPlan != null">is_plan = #{isPlan},</if>
<if test="isAncuo != null">is_ancuo = #{isAncuo},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="companyId != null and companyId != ''">company_id = #{companyId},</if>
update_time = sysdate()
</set>
<if test="companyId != null">company_id = #{companyId},</if>
</trim>
where type_id = #{typeId}
</update>
@ -91,14 +147,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update ma_type set del_flag = '2' where type_id = #{typeId}
</delete>
<select id="selectMaTypeList" resultType="com.bonus.sgzb.base.domain.MaType">
select m.type_id, m.type_name, m.parent_id, m.status, m.num, m.unit_id, m.manage_type, m.lease_price, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load, m.holding_time, m.warn_num, mtf.file_name, mtf.file_url, su.user_name, mpi.prop_name, m.del_flag, m.create_by, m.create_time, m.remark, m.company_id
<select id="selectMaTypeList" parameterType="String" resultMap="MaTypeResult">
select m.type_id, m.type_name, m.parent_id, m.status, m.num, m.unit_id, m.manage_type,
m.lease_price, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load,
m.holding_time, m.warn_num, mtf.file_name photoName, mtf.file_url photoUrl,
mtf2.file_name documentName, mtf2.file_url documentUrl, mtk.user_id keeperUserId,
su.user_name keeperUserName, mpi.prop_name, m.del_flag, m.create_by, m.create_time,
m.remark, m.company_id
from ma_type m
left join ma_prop_set mps on m.type_id = mps.type_id
left join ma_prop_info mpi on mps.prop_id = mpi.prop_id
left join ma_type_file mtf on m.type_id = mtf.type_id
left join (select * from ma_type_file where file_type = '1') mtf on m.type_id = mtf.type_id
left join (select * from ma_type_file where file_type = '2') mtf2 on m.type_id = mtf2.type_id
left join ma_type_keeper mtk on mtf.type_id = mtk.type_id
left join sys_user su on mtk.user_id = su.user_id
<where>
<if test="typeName != null and typeName !=''">
AND type_name like concat('%',#{typeName},'%')
</if>
</where>
</select>
<select id="selectTypeList" resultType="com.bonus.sgzb.base.domain.MaType">
@ -119,4 +186,98 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectMaTypeVo"/>
where type_name = #{typeName} limit 1
</select>
<insert id="insertKeeper">
insert into ma_type_keeper
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="typeId != null">type_id,</if>
<if test="userId != null">user_id,</if>
<if test="time != null">time,</if>
<if test="companyId != null">company_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="typeId != null">#{typeId},</if>
<if test="userId != null">#{userId},</if>
<if test="time != null">#{time},</if>
<if test="companyId != null">#{companyId},</if>
</trim>
</insert>
<insert id="insertRepair">
insert into ma_type_repair
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="typeId != null">type_id,</if>
<if test="userId != null">user_id,</if>
<if test="time != null">time,</if>
<if test="companyId != null">company_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="typeId != null">#{typeId},</if>
<if test="userId != null">#{userId},</if>
<if test="time != null">#{time},</if>
<if test="companyId != null">#{companyId},</if>
</trim>
</insert>
<insert id="insertMaPropSet">
insert into ma_prop_set
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="propId != null">prop_id,</if>
<if test="typeId != null">type_id,</if>
<if test="status != null">status,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="companyId != null">company_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="propId != null">#{propId},</if>
<if test="typeId != null">#{typeId},</if>
<if test="status != null">#{status},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="companyId != null">#{companyId},</if>
</trim>
</insert>
<select id="selectMaTypeByTypeId" resultMap="MaTypeResult">
select m.type_id, m.type_name, m.parent_id, m.status, m.num, m.unit_id, m.manage_type,
m.lease_price, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load,
m.holding_time, m.warn_num, mtf.file_name photoName, mtf.file_url photoUrl,
mtf2.file_name documentName, mtf2.file_url documentUrl, mtk.user_id keeperUserId,
su.user_name keeperUserName, mpi.prop_name, m.del_flag, m.create_by, m.create_time,
m.remark, m.company_id
from ma_type m
left join ma_prop_set mps on m.type_id = mps.type_id
left join ma_prop_info mpi on mps.prop_id = mpi.prop_id
left join (select * from ma_type_file where file_type = '1') mtf on m.type_id = mtf.type_id
left join (select * from ma_type_file where file_type = '2') mtf2 on m.type_id = mtf2.type_id
left join ma_type_keeper mtk on mtf.type_id = mtk.type_id
left join sys_user su on mtk.user_id = su.user_id
where m.type_id = #{typeId}
</select>
<update id="updateKeeperByTypeId">
update ma_type_keeper set user_id = #{userId} where type_id = #{typeId}
</update>
<update id="updateRepairByTypeId">
update ma_type_repair set user_id = #{userId} where type_id = #{typeId}
</update>
<update id="updatePropSetByTypeId">
update ma_prop_set set prop_id = #{propId} where type_id = #{typeId}
</update>
<select id="selectTypeByTypeId" parameterType="long" resultMap="MaTypeResult">
<include refid="selectMaTypeVo"/>
where type_id = #{typeId}
</select>
</mapper>

View File

@ -0,0 +1,92 @@
<?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.sgzb.base.mapper.MaTypeFileMapper">
<resultMap type="com.bonus.sgzb.base.domain.MaTypeFile" id="MaTypeFileResult">
<result property="typeId" column="type_id" />
<result property="maId" column="ma_id" />
<result property="fileName" column="file_name" />
<result property="fileUrl" column="file_url" />
<result property="fileType" column="file_type" />
<result property="userId" column="user_id" />
<result property="time" column="time" />
<result property="status" column="status" />
<result property="companyId" column="company_id" />
</resultMap>
<sql id="selectMaTypeFileVo">
select type_id, ma_id, file_name, file_url, file_type, user_id, time, status, company_id from ma_type_file
</sql>
<select id="selectMaTypeFileList" parameterType="com.bonus.sgzb.base.domain.MaTypeFile" resultMap="MaTypeFileResult">
<include refid="selectMaTypeFileVo"/>
<where>
<if test="maId != null and maId != ''"> and ma_id = #{maId}</if>
<if test="fileName != null and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if>
<if test="fileUrl != null and fileUrl != ''"> and file_url = #{fileUrl}</if>
<if test="fileType != null and fileType != ''"> and file_type = #{fileType}</if>
<if test="userId != null and userId != ''"> and user_id = #{userId}</if>
<if test="time != null and time != ''"> and time = #{time}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId}</if>
</where>
</select>
<select id="selectMaTypeFileByTypeId" parameterType="Long" resultMap="MaTypeFileResult">
<include refid="selectMaTypeFileVo"/>
where type_id = #{typeId}
</select>
<insert id="insertMaTypeFile" parameterType="com.bonus.sgzb.base.domain.MaTypeFile">
insert into ma_type_file
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="typeId != null">type_id,</if>
<if test="maId != null">ma_id,</if>
<if test="fileName != null and fileName != ''">file_name,</if>
<if test="fileUrl != null">file_url,</if>
<if test="fileType != null">file_type,</if>
<if test="userId != null">user_id,</if>
<if test="time != null">time,</if>
<if test="status != null">status,</if>
<if test="companyId != null">company_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="typeId != null">#{typeId},</if>
<if test="maId != null">#{maId},</if>
<if test="fileName != null and fileName != ''">#{fileName},</if>
<if test="fileUrl != null">#{fileUrl},</if>
<if test="fileType != null">#{fileType},</if>
<if test="userId != null">#{userId},</if>
<if test="time != null">#{time},</if>
<if test="status != null">#{status},</if>
<if test="companyId != null">#{companyId},</if>
</trim>
</insert>
<update id="updateMaTypeFile" parameterType="com.bonus.sgzb.base.domain.MaTypeFile">
update ma_type_file
<trim prefix="SET" suffixOverrides=",">
<if test="maId != null">ma_id = #{maId},</if>
<if test="fileName != null and fileName != ''">file_name = #{fileName},</if>
<if test="fileUrl != null">file_url = #{fileUrl},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="time != null">time = #{time},</if>
<if test="status != null">status = #{status},</if>
<if test="companyId != null">company_id = #{companyId},</if>
</trim>
where type_id = #{typeId} and file_type = #{fileType}
</update>
<delete id="deleteMaTypeFileByTypeId" parameterType="Long">
delete from ma_type_file where type_id = #{typeId}
</delete>
<delete id="deleteMaTypeFileByTypeIds" parameterType="String">
delete from ma_type_file where type_id in
<foreach item="typeId" collection="array" open="(" separator="," close=")">
#{typeId}
</foreach>
</delete>
</mapper>