提交相关代码

This commit is contained in:
zfhai 2023-12-06 15:14:52 +08:00
parent a5e2c3b12a
commit 96c6604543
7 changed files with 75 additions and 34 deletions

View File

@ -31,4 +31,8 @@ public class DevInfoVo extends DevInfo {
private Long searchNum; private Long searchNum;
private String examinationPdf; private String examinationPdf;
private String insurancePdf; private String insurancePdf;
/** 1上架2下架*/
private String type;
/**上下架id*/
private int upId;
} }

View File

@ -12,6 +12,7 @@ import com.bonus.zlpt.common.security.annotation.RequiresPermissions;
import com.bonus.zlpt.equip.api.domain.UpOff; import com.bonus.zlpt.equip.api.domain.UpOff;
import com.bonus.zlpt.equip.api.domain.dto.UpOffDto; import com.bonus.zlpt.equip.api.domain.dto.UpOffDto;
import com.bonus.zlpt.equip.api.domain.vo.DevInfoVo;
import com.bonus.zlpt.equip.api.domain.vo.MaDevInfoVo; import com.bonus.zlpt.equip.api.domain.vo.MaDevInfoVo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -107,12 +108,15 @@ public class UpOffController extends BaseController
* 新增设备上下架管理 * 新增设备上下架管理
*/ */
@RequiresPermissions("equip:off:add") // @RequiresPermissions("equip:off:add")
@Log(title = "设备上下架管理", businessType = BusinessType.INSERT) @Log(title = "设备上下架管理", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody UpOff upOff) public AjaxResult add(@RequestBody List<UpOff> upOffList)
{ {
return toAjax(upOffService.insertUpOff(upOff)); if (upOffList.size()==0){
return warn("传入参数为空!");
}
return toAjax(upOffService.insertUpOff(upOffList));
} }
/** /**
@ -122,27 +126,37 @@ public class UpOffController extends BaseController
//@RequiresPermissions("equip:off:edit") //@RequiresPermissions("equip:off:edit")
@Log(title = "设备上下架管理", businessType = BusinessType.UPDATE) @Log(title = "设备上下架管理", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody List<UpOff> upOffList) public AjaxResult edit(@RequestBody UpOff upOff)
{ {
if (upOffList.size()==0){ return toAjax(upOffService.updateUpOff(upOff));
return warn("传入参数为空!");
}
return toAjax(upOffService.updateUpOff(upOffList));
} }
/** /**
* 删除设备上下架管理 * 删除设备上下架管理
*/ */
@RequiresPermissions("equip:off:remove") // @RequiresPermissions("equip:off:remove")
@Log(title = "设备上下架管理", businessType = BusinessType.DELETE) @Log(title = "设备上下架管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @PostMapping("/remove")
public AjaxResult remove(@PathVariable Long[] ids) public AjaxResult remove(@RequestBody Long[] ids)
{ {
return toAjax(upOffService.deleteUpOffByIds(ids)); return toAjax(upOffService.deleteUpOffByIds(ids));
} }
/**
* 商品批量上下架
* @param upOffList
* @return
*/
@Log(title = "设备上下架管理", businessType = BusinessType.INSERT)
@PostMapping("/upOffList")
public AjaxResult upOffList(@RequestBody List<UpOff> upOffList)
{
if (upOffList.size()==0){
return warn("传入参数为空!");
}
return toAjax(upOffService.UpdateUpOffLIst(upOffList));
}
} }

View File

@ -82,4 +82,6 @@ public interface UpOffMapper
* @return * @return
*/ */
List<MaDevInfoVo> selectList(UpOffDto upOffDto); List<MaDevInfoVo> selectList(UpOffDto upOffDto);
void UpdateUpOffLIst(UpOff upOff);
} }

View File

@ -42,21 +42,21 @@ public interface IUpOffService
* 新增设备上下架管理 * 新增设备上下架管理
* *
* @param upOff 设备上下架管理 * @param upOffList 设备上下架管理
* @return 结果 * @return 结果
*/ */
public int insertUpOff(UpOff upOff); public int insertUpOff(List<UpOff> upOffList);
/** /**
* 修改设备上下架管理 * 修改设备上下架管理
* *
* @param upOffList 设备上下架管理 * @param upOff 设备上下架管理
* @return 结果 * @return 结果
*/ */
public int updateUpOff(List<UpOff> upOffList); public int updateUpOff(UpOff upOff);
/** /**
* 批量删除设备上下架管理 * 批量删除设备上下架管理
@ -86,4 +86,6 @@ public interface IUpOffService
List<MaDevInfoVo> selectList(UpOffDto upOffDto); List<MaDevInfoVo> selectList(UpOffDto upOffDto);
List<MaDevInfoVo> selectInfo(List<Long> ids); List<MaDevInfoVo> selectInfo(List<Long> ids);
int UpdateUpOffLIst(List<UpOff> upOffList);
} }

View File

@ -4,6 +4,7 @@ import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.bonus.zlpt.common.security.utils.SecurityUtils;
import com.bonus.zlpt.equip.api.domain.SysFileInfo; import com.bonus.zlpt.equip.api.domain.SysFileInfo;
import com.bonus.zlpt.equip.api.domain.TypeInfo; import com.bonus.zlpt.equip.api.domain.TypeInfo;
import com.bonus.zlpt.equip.api.domain.UpOff; import com.bonus.zlpt.equip.api.domain.UpOff;
@ -17,6 +18,8 @@ import org.springframework.stereotype.Service;
import com.bonus.zlpt.equip.mapper.UpOffMapper; import com.bonus.zlpt.equip.mapper.UpOffMapper;
import com.bonus.zlpt.equip.service.IUpOffService; import com.bonus.zlpt.equip.service.IUpOffService;
import javax.annotation.Resource;
/** /**
* 设备上下架管理 * 设备上下架管理
Service业务层处理 Service业务层处理
@ -27,16 +30,13 @@ Service业务层处理
@Service @Service
public class UpOffServiceImpl implements IUpOffService public class UpOffServiceImpl implements IUpOffService
{ {
@Autowired @Resource
private UpOffMapper upOffMapper; private UpOffMapper upOffMapper;
@Autowired @Resource
private TypeInfoMapper typeInfoMapper; private TypeInfoMapper typeInfoMapper;
// @Autowired @Resource
// private FileInfoMapper fileInfoMapper;
@Autowired
private SysFileInfoMapper sysFileInfoMapper; private SysFileInfoMapper sysFileInfoMapper;
/** /**
@ -73,31 +73,35 @@ public class UpOffServiceImpl implements IUpOffService
* 新增设备上下架管理 * 新增设备上下架管理
* *
* @param upOff 设备上下架管理 * @param upOffList 设备上下架管理
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertUpOff(UpOff upOff) public int insertUpOff(List<UpOff> upOffList)
{ {
return upOffMapper.insertUpOff(upOff); String name = SecurityUtils.getUsername();
for (int i = 0; i < upOffList.size(); i++) {
UpOff UpOff = upOffList.get(i);
UpOff.setApplyUser(name);
upOffMapper.insertUpOff(UpOff);
}
return 1;
} }
/** /**
* 修改设备上下架管理 * 修改设备上下架管理
* *
* @param upOffList 设备上下架管理 * @param upOff 设备上下架管理
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateUpOff(List<UpOff> upOffList) public int updateUpOff(UpOff upOff)
{ {
for (int i = 0; i < upOffList.size(); i++) { return upOffMapper.updateUpOff(upOff);
upOffMapper.updateUpOff(upOffList.get(i));
}
return 1;
} }
/** /**
@ -180,4 +184,14 @@ public class UpOffServiceImpl implements IUpOffService
return devInfoVos; return devInfoVos;
} }
@Override
public int UpdateUpOffLIst(List<UpOff> upOffList) {
for (int i = 0; i < upOffList.size(); i++) {
UpOff UpOff = upOffList.get(i);
upOffMapper.UpdateUpOffLIst(UpOff);
}
return 1;
}
} }

View File

@ -42,12 +42,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql> </sql>
<select id="selectDevInfoList" parameterType="com.bonus.zlpt.equip.api.domain.vo.DevInfoVo" resultType="com.bonus.zlpt.equip.api.domain.vo.DevInfoVo"> <select id="selectDevInfoList" parameterType="com.bonus.zlpt.equip.api.domain.vo.DevInfoVo" resultType="com.bonus.zlpt.equip.api.domain.vo.DevInfoVo">
select d.*,t.type_name as device_name,t.parent_name as group_name,c.company_name select d.*,t.type_name as device_name,t.parent_name as group_name,c.company_name ,u.type, u.id as up_id
from ma_dev_info d from ma_dev_info d
left join (select t.*, p.type_name as parent_name left join (select t.*, p.type_name as parent_name
from ma_type_info t from ma_type_info t
left join ma_type_info p on t.parent_id=p.type_id) t on d.type_id = t.type_id left join ma_type_info p on t.parent_id=p.type_id) t on d.type_id = t.type_id
left join bm_company_info c on d.own_co = c.company_id left join bm_company_info c on d.own_co = c.company_id
left join ma_up_off u on d.ma_id = u.ma_id
<where> <where>
<if test="maId != null "> and d.ma_id = #{maId}</if> <if test="maId != null "> and d.ma_id = #{maId}</if>
<if test="code != null and code != ''"> and d.code = #{code}</if> <if test="code != null and code != ''"> and d.code = #{code}</if>

View File

@ -60,24 +60,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if> <if test="id != null">id,</if>
<if test="maId != null">ma_id,</if> <if test="maId != null">ma_id,</if>
<if test="applyTime != null">apply_time,</if>
<if test="applyUser != null">apply_user,</if> <if test="applyUser != null">apply_user,</if>
<if test="applyCompany != null">apply_company,</if> <if test="applyCompany != null">apply_company,</if>
<if test="type != null">type,</if> <if test="type != null">type,</if>
<if test="auditUser != null">audit_user,</if> <if test="auditUser != null">audit_user,</if>
<if test="auditTime != null">audit_time,</if> <if test="auditTime != null">audit_time,</if>
<if test="status != null">status,</if> <if test="status != null">status,</if>
apply_time
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if> <if test="id != null">#{id},</if>
<if test="maId != null">#{maId},</if> <if test="maId != null">#{maId},</if>
<if test="applyTime != null">#{applyTime},</if>
<if test="applyUser != null">#{applyUser},</if> <if test="applyUser != null">#{applyUser},</if>
<if test="applyCompany != null">#{applyCompany},</if> <if test="applyCompany != null">#{applyCompany},</if>
<if test="type != null">#{type},</if> <if test="type != null">#{type},</if>
<if test="auditUser != null">#{auditUser},</if> <if test="auditUser != null">#{auditUser},</if>
<if test="auditTime != null">#{auditTime},</if> <if test="auditTime != null">#{auditTime},</if>
<if test="status != null">#{status},</if> <if test="status != null">#{status},</if>
sysdate()
</trim> </trim>
</insert> </insert>
@ -106,4 +106,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
<update id="UpdateUpOffLIst" parameterType="com.bonus.zlpt.equip.api.domain.UpOff">
update ma_up_off set type = #{type} where ma_id = #{maId}
</update>
</mapper> </mapper>