物资类型管理--逻辑删除、过滤

This commit is contained in:
syruan 2024-10-14 15:03:00 +08:00
parent 3527f9834d
commit 38ad174175
6 changed files with 128 additions and 132 deletions

View File

@ -25,94 +25,86 @@ import com.bonus.common.core.utils.poi.ExcelUtil;
import com.bonus.common.core.web.page.TableDataInfo; import com.bonus.common.core.web.page.TableDataInfo;
/** /**
* 机具类型管理Controller * 物资类型管理Controller
* * @author syruan
* @author xsheng
* @date 2024-09-27
*/ */
@Api(tags = "机具类型管理接口") @Api(tags = "物资类型管理接口")
@RestController @RestController
@RequestMapping("/ma_type") @RequestMapping("/ma_type")
public class TypeController extends BaseController public class TypeController extends BaseController {
{
@Autowired @Autowired
private ITypeService typeService; private ITypeService typeService;
/** /**
* 查询机具类型管理列表 * 查询物资类型管理列表
*/ */
@ApiOperation(value = "查询机具类型管理列表") @ApiOperation(value = "查询物资类型管理列表")
@RequiresPermissions("ma:type:list") @RequiresPermissions("ma:type:list")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(Type type) public TableDataInfo list(Type type) {
{
startPage(); startPage();
List<Type> list = typeService.selectTypeList(type); List<Type> list = typeService.selectTypeList(type);
return getDataTable(list); return getDataTable(list);
} }
/** /**
* 导出机具类型管理列表 * 导出物资类型管理列表
*/ */
@ApiOperation(value = "导出机具类型管理列表") @ApiOperation(value = "导出物资类型管理列表")
@PreventRepeatSubmit @PreventRepeatSubmit
@RequiresPermissions("ma:type:export") @RequiresPermissions("ma:type:export")
@SysLog(title = "机具类型管理", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出机具类型管理") @SysLog(title = "物资类型管理", businessType = OperaType.EXPORT, module = "仓储管理->导出物资类型")
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, Type type) public void export(HttpServletResponse response, Type type) {
{
List<Type> list = typeService.selectTypeList(type); List<Type> list = typeService.selectTypeList(type);
ExcelUtil<Type> util = new ExcelUtil<Type>(Type.class); ExcelUtil<Type> util = new ExcelUtil<Type>(Type.class);
util.exportExcel(response, list, "机具类型管理数据"); util.exportExcel(response, list, "物资类型管理数据");
} }
/** /**
* 获取机具类型管理详细信息 * 获取物资类型管理详细信息
*/ */
@ApiOperation(value = "获取机具类型管理详细信息") @ApiOperation(value = "获取物资类型管理详细信息")
@RequiresPermissions("ma:type:query") @RequiresPermissions("ma:type:query")
@GetMapping(value = "/{typeId}") @GetMapping(value = "/{typeId}")
public AjaxResult getInfo(@PathVariable("typeId") Long typeId) public AjaxResult getInfo(@PathVariable("typeId") Long typeId) {
{
return success(typeService.selectTypeByTypeId(typeId)); return success(typeService.selectTypeByTypeId(typeId));
} }
/** /**
* 新增机具类型管理 * 新增物资类型管理
*/ */
@ApiOperation(value = "新增机具类型管理") @ApiOperation(value = "新增物资类型管理")
@PreventRepeatSubmit @PreventRepeatSubmit
@RequiresPermissions("ma:type:add") @RequiresPermissions("ma:type:add")
@SysLog(title = "机具类型管理", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增机具类型管理") @SysLog(title = "物资类型管理", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增物资类型")
@PostMapping @PostMapping
public AjaxResult add(@RequestBody Type type) public AjaxResult add(@RequestBody Type type) {
{
return toAjax(typeService.insertType(type)); return toAjax(typeService.insertType(type));
} }
/** /**
* 修改机具类型管理 * 修改物资类型管理
*/ */
@ApiOperation(value = "修改机具类型管理") @ApiOperation(value = "修改物资类型管理")
@PreventRepeatSubmit @PreventRepeatSubmit
@RequiresPermissions("ma:type:edit") @RequiresPermissions("ma:type:edit")
@SysLog(title = "机具类型管理", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改机具类型管理") @SysLog(title = "物资类型管理", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改物资类型")
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody Type type) public AjaxResult edit(@RequestBody Type type) {
{
return toAjax(typeService.updateType(type)); return toAjax(typeService.updateType(type));
} }
/** /**
* 删除机具类型管理 * 删除物资类型管理
*/ */
@ApiOperation(value = "删除机具类型管理") @ApiOperation(value = "删除物资类型管理")
@PreventRepeatSubmit @PreventRepeatSubmit
@RequiresPermissions("ma:type:remove") @RequiresPermissions("ma:type:remove")
@SysLog(title = "机具类型管理", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除机具类型管理") @SysLog(title = "物资类型管理", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除物资类型")
@DeleteMapping("/{typeIds}") @DeleteMapping("/{typeIds}")
public AjaxResult remove(@PathVariable Long[] typeIds) public AjaxResult remove(@PathVariable Long[] typeIds) {
{
return toAjax(typeService.deleteTypeByTypeIds(typeIds)); return toAjax(typeService.deleteTypeByTypeIds(typeIds));
} }
} }

View File

@ -6,21 +6,19 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import com.bonus.common.core.annotation.Excel; import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
import com.bonus.common.core.web.domain.BaseEntity; import com.bonus.common.core.web.domain.BaseEntity;
/** /**
* 机具类型管理对象 ma_type * 物资类型对象 ma_type
* * @author syruan
* @author xsheng
* @date 2024-09-27
*/ */
@EqualsAndHashCode(callSuper = false)
@Data @Data
@ToString @ToString
public class Type extends BaseEntity public class Type extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 类型ID */ /** 类型ID */

View File

@ -2,60 +2,67 @@ package com.bonus.material.ma.mapper;
import java.util.List; import java.util.List;
import com.bonus.material.ma.domain.Type; import com.bonus.material.ma.domain.Type;
import org.apache.ibatis.annotations.Mapper;
/** /**
* 机具类型管理Mapper接口 * 物资类型Mapper接口
* * @author syruan
* @author xsheng
* @date 2024-09-27
*/ */
public interface TypeMapper @Mapper
{ public interface TypeMapper {
/** /**
* 查询机具类型管理 * 查询物资类型
* *
* @param typeId 机具类型管理主键 * @param typeId 物资类型主键
* @return 机具类型管理 * @return 物资类型
*/ */
public Type selectTypeByTypeId(Long typeId); Type selectTypeByTypeId(Long typeId);
/** /**
* 查询机具类型管理列表 * 查询物资类型列表
* *
* @param type 机具类型管理 * @param type 物资类型
* @return 机具类型管理集合 * @return 物资类型集合
*/ */
public List<Type> selectTypeList(Type type); List<Type> selectTypeList(Type type);
/** /**
* 新增机具类型管理 * 新增物资类型
* *
* @param type 机具类型管理 * @param type 物资类型
* @return 结果 * @return 结果
*/ */
public int insertType(Type type); int insertType(Type type);
/** /**
* 修改机具类型管理 * 修改物资类型
* *
* @param type 机具类型管理 * @param type 物资类型
* @return 结果 * @return 结果
*/ */
public int updateType(Type type); int updateType(Type type);
/** /**
* 删除机具类型管理 * 删除物资类型 -- 真实删除
* *
* @param typeId 机具类型管理主键 * @param typeId 物资类型主键
* @return 结果 * @return 结果
*/ */
public int deleteTypeByTypeId(Long typeId); int deleteTypeByTypeId(Long typeId);
/** /**
* 批量删除机具类型管理 * 删除物资类型 -- 逻辑删除
*
* @param typeId 物资类型主键
* @return 结果
*/
int logicDeleteTypeByTypeId(Long typeId);
/**
* 批量删除物资类型 -- 逻辑删除
* *
* @param typeIds 需要删除的数据主键集合 * @param typeIds 需要删除的数据主键集合
* @return 结果 * @return 结果
*/ */
public int deleteTypeByTypeIds(Long[] typeIds); int logicDeleteTypeByTypeIds(Long[] typeIds);
} }

View File

@ -4,58 +4,55 @@ import java.util.List;
import com.bonus.material.ma.domain.Type; import com.bonus.material.ma.domain.Type;
/** /**
* 机具类型管理Service接口 * 物资类型Service接口
* * @author syruan
* @author xsheng
* @date 2024-09-27
*/ */
public interface ITypeService public interface ITypeService {
{
/** /**
* 查询机具类型管理 * 查询物资类型
* *
* @param typeId 机具类型管理主键 * @param typeId 物资类型主键
* @return 机具类型管理 * @return 物资类型
*/ */
public Type selectTypeByTypeId(Long typeId); Type selectTypeByTypeId(Long typeId);
/** /**
* 查询机具类型管理列表 * 查询物资类型列表
* *
* @param type 机具类型管理 * @param type 物资类型
* @return 机具类型管理集合 * @return 物资类型集合
*/ */
public List<Type> selectTypeList(Type type); List<Type> selectTypeList(Type type);
/** /**
* 新增机具类型管理 * 新增物资类型
* *
* @param type 机具类型管理 * @param type 物资类型
* @return 结果 * @return 结果
*/ */
public int insertType(Type type); int insertType(Type type);
/** /**
* 修改机具类型管理 * 修改物资类型
* *
* @param type 机具类型管理 * @param type 物资类型
* @return 结果 * @return 结果
*/ */
public int updateType(Type type); int updateType(Type type);
/** /**
* 批量删除机具类型管理 * 批量删除物资类型
* *
* @param typeIds 需要删除的机具类型管理主键集合 * @param typeIds 需要删除的物资类型主键集合
* @return 结果 * @return 结果
*/ */
public int deleteTypeByTypeIds(Long[] typeIds); int deleteTypeByTypeIds(Long[] typeIds);
/** /**
* 删除机具类型管理信息 * 删除物资类型信息
* *
* @param typeId 机具类型管理主键 * @param typeId 物资类型主键
* @return 结果 * @return 结果
*/ */
public int deleteTypeByTypeId(Long typeId); int deleteTypeByTypeId(Long typeId);
} }

View File

@ -8,35 +8,34 @@ import com.bonus.material.ma.mapper.TypeMapper;
import com.bonus.material.ma.domain.Type; import com.bonus.material.ma.domain.Type;
import com.bonus.material.ma.service.ITypeService; import com.bonus.material.ma.service.ITypeService;
import javax.annotation.Resource;
/** /**
* 机具类型管理Service业务层处理 * 物资类型管理Service业务层实现
* * @author syruan
* @author xsheng
* @date 2024-09-27
*/ */
@Service @Service
public class TypeServiceImpl implements ITypeService public class TypeServiceImpl implements ITypeService {
{
@Autowired @Resource
private TypeMapper typeMapper; private TypeMapper typeMapper;
/** /**
* 查询机具类型管理 * 查询物资类型管理
* *
* @param typeId 机具类型管理主键 * @param typeId 物资类型管理主键
* @return 机具类型管理 * @return 物资类型管理
*/ */
@Override @Override
public Type selectTypeByTypeId(Long typeId) public Type selectTypeByTypeId(Long typeId) {
{
return typeMapper.selectTypeByTypeId(typeId); return typeMapper.selectTypeByTypeId(typeId);
} }
/** /**
* 查询机具类型管理列表 * 查询物资类型管理列表
* *
* @param type 机具类型管理 * @param type 物资类型管理
* @return 机具类型管理 * @return 物资类型管理
*/ */
@Override @Override
public List<Type> selectTypeList(Type type) public List<Type> selectTypeList(Type type)
@ -45,22 +44,21 @@ public class TypeServiceImpl implements ITypeService
} }
/** /**
* 新增机具类型管理 * 新增物资类型管理
* *
* @param type 机具类型管理 * @param type 物资类型管理
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertType(Type type) public int insertType(Type type) {
{
type.setCreateTime(DateUtils.getNowDate()); type.setCreateTime(DateUtils.getNowDate());
return typeMapper.insertType(type); return typeMapper.insertType(type);
} }
/** /**
* 修改机具类型管理 * 修改物资类型管理
* *
* @param type 机具类型管理 * @param type 物资类型管理
* @return 结果 * @return 结果
*/ */
@Override @Override
@ -71,26 +69,25 @@ public class TypeServiceImpl implements ITypeService
} }
/** /**
* 批量删除机具类型管理 * 批量删除物资类型管理
* *
* @param typeIds 需要删除的机具类型管理主键 * @param typeIds 需要删除的物资类型管理主键
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteTypeByTypeIds(Long[] typeIds) public int deleteTypeByTypeIds(Long[] typeIds)
{ {
return typeMapper.deleteTypeByTypeIds(typeIds); return typeMapper.logicDeleteTypeByTypeIds(typeIds);
} }
/** /**
* 删除机具类型管理信息 * 删除物资类型
* *
* @param typeId 机具类型管理主键 * @param typeId 物资类型管理主键
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteTypeByTypeId(Long typeId) public int deleteTypeByTypeId(Long typeId) {
{ return typeMapper.logicDeleteTypeByTypeId(typeId);
return typeMapper.deleteTypeByTypeId(typeId);
} }
} }

View File

@ -3,6 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.material.ma.mapper.TypeMapper"> <mapper namespace="com.bonus.material.ma.mapper.TypeMapper">
<resultMap type="com.bonus.material.ma.domain.Type" id="TypeResult"> <resultMap type="com.bonus.material.ma.domain.Type" id="TypeResult">
<result property="typeId" column="type_id" /> <result property="typeId" column="type_id" />
<result property="typeName" column="type_name" /> <result property="typeName" column="type_name" />
@ -35,7 +36,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectTypeVo"> <sql id="selectTypeVo">
select type_id, type_name, parent_id, storage_num, type_code, model_code, unit_id, manage_type, lease_price, eff_time, rent_price, buy_price, pay_ratio, level, rated_load, test_load, holding_time, warn_num, del_flag, create_by, create_time, update_by, update_time, is_plan, is_ancuo, remark, fac_model, intelligent_code from ma_type select
type_id, type_name, parent_id, storage_num, type_code, model_code, unit_id, manage_type, lease_price,
eff_time, rent_price, buy_price, pay_ratio, level, rated_load, test_load, holding_time, warn_num,
create_by, create_time, update_by, update_time, is_plan,is_ancuo, remark, fac_model, intelligent_code
from ma_type
</sql> </sql>
<select id="selectTypeList" parameterType="com.bonus.material.ma.domain.Type" resultMap="TypeResult"> <select id="selectTypeList" parameterType="com.bonus.material.ma.domain.Type" resultMap="TypeResult">
@ -62,6 +67,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isAncuo != null and isAncuo != ''"> and is_ancuo = #{isAncuo}</if> <if test="isAncuo != null and isAncuo != ''"> and is_ancuo = #{isAncuo}</if>
<if test="facModel != null and facModel != ''"> and fac_model = #{facModel}</if> <if test="facModel != null and facModel != ''"> and fac_model = #{facModel}</if>
<if test="intelligentCode != null and intelligentCode != ''"> and intelligent_code = #{intelligentCode}</if> <if test="intelligentCode != null and intelligentCode != ''"> and intelligent_code = #{intelligentCode}</if>
and del_flag = '0'
</where> </where>
</select> </select>
@ -90,7 +96,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="testLoad != null">test_load,</if> <if test="testLoad != null">test_load,</if>
<if test="holdingTime != null">holding_time,</if> <if test="holdingTime != null">holding_time,</if>
<if test="warnNum != null">warn_num,</if> <if test="warnNum != null">warn_num,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if> <if test="updateBy != null">update_by,</if>
@ -119,7 +124,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="testLoad != null">#{testLoad},</if> <if test="testLoad != null">#{testLoad},</if>
<if test="holdingTime != null">#{holdingTime},</if> <if test="holdingTime != null">#{holdingTime},</if>
<if test="warnNum != null">#{warnNum},</if> <if test="warnNum != null">#{warnNum},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if> <if test="updateBy != null">#{updateBy},</if>
@ -152,9 +156,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="testLoad != null">test_load = #{testLoad},</if> <if test="testLoad != null">test_load = #{testLoad},</if>
<if test="holdingTime != null">holding_time = #{holdingTime},</if> <if test="holdingTime != null">holding_time = #{holdingTime},</if>
<if test="warnNum != null">warn_num = #{warnNum},</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="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if> <if test="updateTime != null">update_time = #{updateTime},</if>
<if test="isPlan != null">is_plan = #{isPlan},</if> <if test="isPlan != null">is_plan = #{isPlan},</if>
@ -170,10 +171,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
delete from ma_type where type_id = #{typeId} delete from ma_type where type_id = #{typeId}
</delete> </delete>
<delete id="deleteTypeByTypeIds" parameterType="String"> <delete id="logicDeleteTypeByTypeIds" parameterType="String">
delete from ma_type where type_id in update ma_type set del_flag = 2 where type_id in
<foreach item="typeId" collection="array" open="(" separator="," close=")"> <foreach item="typeId" collection="array" open="(" separator="," close=")">
#{typeId} #{typeId}
</foreach> </foreach>
</delete> </delete>
<update id="logicDeleteTypeByTypeId">
update ma_type set del_flag = 2 where type_id = #{typeId,jdbcType=BIGINT}
</update>
</mapper> </mapper>