功能完善
This commit is contained in:
parent
25477c1289
commit
8dc5fc562c
|
|
@ -89,24 +89,13 @@ public class MaPropInfoController extends BaseController {
|
|||
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/save")
|
||||
public AjaxResult save(@Validated @RequestBody MaPropSet maPropSet){
|
||||
/* if (!maPropInfoService.checkPropIdUnique(maPropSet)) {
|
||||
return error("资产名称'" + maPropSet.getTypeId() + "'失败,资产名称已存在");
|
||||
}*/
|
||||
Long fieldValue =maPropSet.getTypeId();
|
||||
Long fieldValues =maPropSet.getPropId();
|
||||
if (maPropSet.getPropName() != null){
|
||||
return toAjax(maPropInfoService.updateMaPropSet(maPropSet));
|
||||
}
|
||||
/*List<MaPropSet> ben= maPropInfoService.checkPropIdUnique(maPropSet);
|
||||
for (MaPropSet s:ben) {
|
||||
if(s.)
|
||||
Long fieldValue =s.getId();
|
||||
if(fieldValue !=null ){
|
||||
|
||||
}
|
||||
}*/
|
||||
return toAjax(maPropInfoService.insertMaPropSet(maPropSet));
|
||||
|
||||
// Long fieldValue =maPropSet.getTypeId();
|
||||
// Long fieldValues =maPropSet.getPropId();
|
||||
// if (maPropSet.getPropName() != null){
|
||||
// return toAjax(maPropInfoService.updateMaPropSet(maPropSet));
|
||||
// }
|
||||
// return toAjax(maPropInfoService.insertMaPropSet(maPropSet));
|
||||
return toAjax(maPropInfoService.save(maPropSet));
|
||||
|
||||
}
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -36,12 +36,12 @@ public class MaPropSetController extends BaseController
|
|||
* 删除资产属性配置ma_prop_set
|
||||
*/
|
||||
@Log(title = "资产属性配置ma_prop_set", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{propIds}")
|
||||
public AjaxResult remove(@PathVariable Long propIds)
|
||||
@DeleteMapping("/{typeIds}")
|
||||
public AjaxResult remove(@PathVariable String typeIds)
|
||||
{
|
||||
AjaxResult b = null;
|
||||
try{
|
||||
b = toAjax(maPropInfoService.deleteMaPropSetByPropIds(propIds));
|
||||
b = toAjax(maPropInfoService.deleteMaPropSetByPropIds(typeIds));
|
||||
}catch (Exception e){
|
||||
logger.error(e.toString(),e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.sgzb.base.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
|
@ -18,6 +19,10 @@ public class MaPropSet {
|
|||
* 类型ID
|
||||
*/
|
||||
private long typeId;
|
||||
|
||||
@ApiModelProperty(value = "类型ids")
|
||||
private String typeIds;
|
||||
|
||||
/**
|
||||
* 帐号状态(0正常 1停用)
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -78,5 +78,9 @@ public interface MaPropInfoMapper {
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteMaPropSetByPropIds(Long propIds);
|
||||
|
||||
int deleteByIdsAll(String[] typeIds);
|
||||
|
||||
int add(List<MaPropSet> list);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -90,9 +90,11 @@ public interface IMaPropInfoService {
|
|||
/**
|
||||
* 批量删除资产属性配置ma_prop_set
|
||||
*
|
||||
* @param propIds 需要删除的资产属性配置ma_prop_set主键集合
|
||||
* @param typeIds 需要删除的资产属性配置ma_prop_set主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMaPropSetByPropIds(Long propIds);
|
||||
public int deleteMaPropSetByPropIds(String typeIds);
|
||||
|
||||
int save(MaPropSet maPropSet);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,17 +3,21 @@ package com.bonus.sgzb.base.service.impl;
|
|||
import com.bonus.sgzb.base.api.domain.MaType;
|
||||
import com.bonus.sgzb.base.domain.MaPropInfo;
|
||||
import com.bonus.sgzb.base.domain.MaPropSet;
|
||||
import com.bonus.sgzb.base.domain.WarehouseKeeper;
|
||||
import com.bonus.sgzb.base.mapper.MaPropInfoMapper;
|
||||
import com.bonus.sgzb.base.service.IMaPropInfoService;
|
||||
import com.bonus.sgzb.common.core.constant.UserConstants;
|
||||
import com.bonus.sgzb.common.core.exception.ServiceException;
|
||||
import com.bonus.sgzb.common.core.utils.StringHelper;
|
||||
import com.bonus.sgzb.common.core.utils.StringUtils;
|
||||
import com.bonus.sgzb.common.core.utils.bean.BeanValidators;
|
||||
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.validation.Validator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -34,7 +38,7 @@ public class MaPropInfoServiceImpl implements IMaPropInfoService {
|
|||
|
||||
/**
|
||||
* 查询资产属性列表
|
||||
* @param propName
|
||||
* @param maPropInfo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
|
|
@ -200,15 +204,45 @@ public class MaPropInfoServiceImpl implements IMaPropInfoService {
|
|||
/**
|
||||
* 批量删除资产属性配置ma_prop_set
|
||||
*
|
||||
* @param propIds 需要删除的资产属性配置ma_prop_set主键
|
||||
* @param typeIds 需要删除的资产属性配置ma_prop_set主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMaPropSetByPropIds(Long propIds)
|
||||
public int deleteMaPropSetByPropIds(String typeIds)
|
||||
{
|
||||
|
||||
int deleteMaPropSetByPropIds = maPropInfoMapper.deleteMaPropSetByPropIds(propIds);
|
||||
return deleteMaPropSetByPropIds;
|
||||
if(StringHelper.isNotEmpty(typeIds)){
|
||||
String[] splitTypeIds = typeIds.split("@");
|
||||
//删除
|
||||
return maPropInfoMapper.deleteByIdsAll(splitTypeIds);
|
||||
}else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int save(MaPropSet bean) {
|
||||
List<MaPropSet> list=new ArrayList<>();
|
||||
String typeIds=bean.getTypeIds();
|
||||
if(StringHelper.isNotEmpty(typeIds)){
|
||||
String[] splitTypeIds = typeIds.split("@");
|
||||
//先删除,在去添加
|
||||
maPropInfoMapper.deleteByIdsAll(splitTypeIds);
|
||||
for (String typeId : splitTypeIds) {
|
||||
MaPropSet beans = new MaPropSet();
|
||||
beans.setTypeIds(typeId);
|
||||
beans.setPropId(bean.getPropId());
|
||||
beans.setCompanyId(bean.getCompanyId());
|
||||
beans.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
|
||||
list.add(beans);
|
||||
}
|
||||
}
|
||||
int i =0;
|
||||
if(list.size()>0){
|
||||
i= maPropInfoMapper.add(list);
|
||||
}else{
|
||||
|
||||
}
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,13 +65,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
from ma_prop_info
|
||||
</sql>
|
||||
<select id="selectMaType" resultMap="MaTypeResult" parameterType="com.bonus.sgzb.base.api.domain.MaType">
|
||||
select m.type_id, m.type_name, m.parent_id, m.status, m.num, m.unit_id, m.unit_name, m.manage_type,
|
||||
m.lease_price, m.rent_price, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load,
|
||||
m.holding_time, m.warn_num, m.del_flag, m.create_by, m.create_time,
|
||||
m.remark, m.company_id ,e.prop_name,l.id
|
||||
from ma_type m
|
||||
left join ma_prop_set l on m.type_id = l.type_id
|
||||
left join ma_prop_info e on e.prop_id = l.prop_id
|
||||
SELECT
|
||||
m.type_id,
|
||||
m.type_name,
|
||||
m.unit_name,
|
||||
m.lease_price,
|
||||
m.rent_price,
|
||||
m.buy_price,
|
||||
m.pay_price,
|
||||
m.remark,
|
||||
e.prop_name,
|
||||
us.user_name as keeperUserName,
|
||||
mtf.file_name photoName,
|
||||
mtf.file_url photoUrl,
|
||||
mtf2.file_name documentName,
|
||||
mtf2.file_url documentUrl
|
||||
FROM
|
||||
ma_type m
|
||||
LEFT JOIN ma_prop_set l ON m.type_id = l.type_id
|
||||
LEFT JOIN ma_prop_info e ON e.prop_id = l.prop_id
|
||||
LEFT JOIN ma_type_keeper mtk on mtk.type_id=m.type_id
|
||||
LEFT JOIN sys_user us on us.user_id=mtk.user_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
|
||||
<where>
|
||||
level = 4 and m.status = '0'
|
||||
<if test="typeName != null and typeName !=''">
|
||||
|
|
@ -148,6 +164,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
<insert id="add">
|
||||
insert into ma_prop_set(type_id, prop_id,company_id,create_by,create_time) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
(#{item.typeIds},#{item.propId},#{item.companyId},#{item.createBy},NOW())
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="updateMaProp">
|
||||
update ma_prop_info
|
||||
|
|
@ -171,6 +193,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<delete id="deleteMaPropSetByPropIds">
|
||||
delete from ma_prop_set where type_id =#{typeId}
|
||||
</delete>
|
||||
<delete id="deleteByIdsAll">
|
||||
delete from ma_prop_set where type_id in
|
||||
<foreach item="typeIds" collection="array" open="(" separator="," close=")">
|
||||
#{typeIds}
|
||||
</foreach>
|
||||
</delete>
|
||||
<select id="selectMaPropSet" resultType="com.bonus.sgzb.base.domain.MaPropInfo" resultMap="MaPropInfoResult">
|
||||
select a.prop_id, a.prop_name, a.code, a.status, a.dept_id, a.del_flag, a.create_by,
|
||||
a.create_time, a.remark, a.company_id ,b.dept_name
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService
|
|||
task.setCode(purchaseCodeRule());
|
||||
task.setCreateTime(DateUtils.getNowDate());
|
||||
task.setCompanyId(purchaseCheckInfo.getCompanyId());
|
||||
task.setCreateBy(SecurityUtils.getUsername());
|
||||
task.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
|
||||
// 创建任务信息
|
||||
taskMapper.insertTmTask(task);
|
||||
purchaseCheckInfo.setTaskId(task.getTaskId());
|
||||
|
|
|
|||
|
|
@ -96,8 +96,8 @@ public class SelectController {
|
|||
|
||||
@ApiOperation(value = "配件所属上级树")
|
||||
@PostMapping("getAccessoryTree")
|
||||
public AjaxResult getAccessoryTree(@RequestBody SelectDto dto){
|
||||
return service.getAccessoryTree(dto);
|
||||
public AjaxResult getAccessoryTree(){
|
||||
return service.getAccessoryTree();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "配件所属上级树")
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ public interface SelectMapper {
|
|||
* @author cwchen
|
||||
* @date 2023/12/20 20:26
|
||||
*/
|
||||
List<TreeNode> getAccessoryTree(SelectDto dto);
|
||||
List<TreeNode> getAccessoryTree();
|
||||
|
||||
/**
|
||||
* @param dto
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ public interface SelectService {
|
|||
* @author cwchen
|
||||
* @date 2023/12/20 20:25
|
||||
*/
|
||||
AjaxResult getAccessoryTree(SelectDto dto);
|
||||
AjaxResult getAccessoryTree();
|
||||
|
||||
/**
|
||||
* @param dto
|
||||
|
|
|
|||
|
|
@ -175,11 +175,11 @@ public class SelectServiceImpl implements SelectService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getAccessoryTree(SelectDto dto) {
|
||||
public AjaxResult getAccessoryTree() {
|
||||
List<TreeNode> groupList = new ArrayList<>();
|
||||
List<TreeNode> list = new ArrayList<>();
|
||||
try {
|
||||
list = mapper.getAccessoryTree(dto);
|
||||
list = mapper.getAccessoryTree();
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
// 创建树形结构(数据集合作为参数)
|
||||
TreeBuild treeBuild = new TreeBuild(list);
|
||||
|
|
|
|||
|
|
@ -141,6 +141,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
SELECT pa_id AS id,
|
||||
pa_name AS label,
|
||||
parent_id AS parentId,
|
||||
unit_id as unitName,
|
||||
level
|
||||
FROM ma_part_type
|
||||
WHERE del_flag = '0'
|
||||
|
|
|
|||
Loading…
Reference in New Issue