| @ -0,0 +1,69 @@ | |||
| package com.hxhq.business.controller; | |||
| import java.util.Arrays; | |||
| import java.util.List; | |||
| import com.hxhq.common.security.annotation.RequiresPermissions; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import com.hxhq.business.domain.StorageLocation; | |||
| import com.hxhq.business.service.IStorageLocationService; | |||
| import com.hxhq.common.core.web.controller.BaseController; | |||
| import com.hxhq.common.core.web.domain.AjaxResult; | |||
| import com.hxhq.common.core.web.page.TableDataInfo; | |||
| /** | |||
| * 存储位置Controller | |||
| * | |||
| * @author hxhq | |||
| * @date 2026-03-02 | |||
| */ | |||
| @RestController | |||
| @RequestMapping("/business/storageLocation") | |||
| public class StorageLocationController extends BaseController | |||
| { | |||
| @Autowired | |||
| private IStorageLocationService storageLocationService; | |||
| /** | |||
| * 查询存储位置列表 | |||
| */ | |||
| @GetMapping("/list") | |||
| @RequiresPermissions("business:storageLocation:list") | |||
| public TableDataInfo list(StorageLocation storageLocation) | |||
| { | |||
| startPage(); | |||
| List<StorageLocation> list = storageLocationService.queryList(storageLocation); | |||
| return getDataTable(list); | |||
| } | |||
| /** | |||
| * 获取存储位置详细信息 | |||
| */ | |||
| @GetMapping(value = "/info") | |||
| public AjaxResult getInfo(Long id) | |||
| { | |||
| return AjaxResult.success(storageLocationService.getById(id)); | |||
| } | |||
| /** | |||
| * 新增存储位置信息 | |||
| */ | |||
| @PostMapping("/save") | |||
| @RequiresPermissions("business:storageLocation:add") | |||
| public AjaxResult save(@RequestBody StorageLocation storageLocation) | |||
| { | |||
| return toAjax(storageLocationService.saveOrUpdate(storageLocation)); | |||
| } | |||
| /** | |||
| * 新增存储位置信息 | |||
| */ | |||
| @PostMapping("/edit") | |||
| @RequiresPermissions("business:storageLocation:edit") | |||
| public AjaxResult edit(@RequestBody StorageLocation storageLocation) | |||
| { | |||
| return toAjax(storageLocationService.saveOrUpdate(storageLocation)); | |||
| } | |||
| } | |||
| @ -0,0 +1,108 @@ | |||
| package com.hxhq.business.domain; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.hxhq.common.core.domain.MpBaseEntity; | |||
| /** | |||
| * 存储位置对象 t_storage_location | |||
| * | |||
| * @author hxhq | |||
| * @date 2026-03-02 | |||
| */ | |||
| @TableName("t_storage_location") | |||
| public class StorageLocation extends MpBaseEntity | |||
| { | |||
| private static final long serialVersionUID = 1L; | |||
| /** 放置地点 */ | |||
| private String location; | |||
| /** 设备名称或编号 */ | |||
| private String name; | |||
| /** 放置货架 */ | |||
| private String shelfPlacement; | |||
| /** 温层 */ | |||
| private String compartment; | |||
| /** 部门id */ | |||
| private Long deptId; | |||
| /** 状态 1-禁用 10-启用 */ | |||
| private Integer status; | |||
| @TableField(exist = false) | |||
| private String deptName; | |||
| public String getDeptName() { | |||
| return deptName; | |||
| } | |||
| public void setDeptName(String deptName) { | |||
| this.deptName = deptName; | |||
| } | |||
| public void setLocation(String location) | |||
| { | |||
| this.location = location; | |||
| } | |||
| public String getLocation() | |||
| { | |||
| return location; | |||
| } | |||
| public void setName(String name) | |||
| { | |||
| this.name = name; | |||
| } | |||
| public String getName() | |||
| { | |||
| return name; | |||
| } | |||
| public void setShelfPlacement(String shelfPlacement) | |||
| { | |||
| this.shelfPlacement = shelfPlacement; | |||
| } | |||
| public String getShelfPlacement() | |||
| { | |||
| return shelfPlacement; | |||
| } | |||
| public void setCompartment(String compartment) | |||
| { | |||
| this.compartment = compartment; | |||
| } | |||
| public String getCompartment() | |||
| { | |||
| return compartment; | |||
| } | |||
| public void setDeptId(Long deptId) | |||
| { | |||
| this.deptId = deptId; | |||
| } | |||
| public Long getDeptId() | |||
| { | |||
| return deptId; | |||
| } | |||
| public void setStatus(Integer status) | |||
| { | |||
| this.status = status; | |||
| } | |||
| public Integer getStatus() | |||
| { | |||
| return status; | |||
| } | |||
| } | |||
| @ -0,0 +1,25 @@ | |||
| package com.hxhq.business.mapper; | |||
| import com.baomidou.mybatisplus.core.conditions.Wrapper; | |||
| import com.hxhq.business.domain.Bacteria; | |||
| import com.hxhq.business.domain.StorageLocation; | |||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import java.util.List; | |||
| /** | |||
| * 存储位置Mapper接口 | |||
| * | |||
| * @author hxhq | |||
| * @date 2026-03-02 | |||
| */ | |||
| public interface StorageLocationMapper extends BaseMapper<StorageLocation> | |||
| { | |||
| /** | |||
| * 列表 | |||
| * @param queryWrapper | |||
| * @return | |||
| */ | |||
| List<StorageLocation> queryList(@Param("ew") Wrapper<StorageLocation> queryWrapper); | |||
| } | |||
| @ -0,0 +1,23 @@ | |||
| package com.hxhq.business.service; | |||
| import java.util.List; | |||
| import com.hxhq.business.domain.StorageLocation; | |||
| import com.baomidou.mybatisplus.extension.service.IService; | |||
| /** | |||
| * 存储位置Service接口 | |||
| * | |||
| * @author hxhq | |||
| * @date 2026-03-02 | |||
| */ | |||
| public interface IStorageLocationService extends IService<StorageLocation> | |||
| { | |||
| /** | |||
| * 查询存储位置列表 | |||
| * | |||
| * @param storageLocation 存储位置 | |||
| * @return 存储位置集合 | |||
| */ | |||
| public List<StorageLocation> queryList(StorageLocation storageLocation); | |||
| } | |||
| @ -0,0 +1,49 @@ | |||
| package com.hxhq.business.service.impl; | |||
| import java.util.List; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
| import com.hxhq.common.core.utils.DateUtils; | |||
| import com.hxhq.common.core.utils.StringUtils; | |||
| import org.springframework.stereotype.Service; | |||
| import com.hxhq.business.mapper.StorageLocationMapper; | |||
| import com.hxhq.business.domain.StorageLocation; | |||
| import com.hxhq.business.service.IStorageLocationService; | |||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
| /** | |||
| * 存储位置Service业务层处理 | |||
| * | |||
| * @author hxhq | |||
| * @date 2026-03-02 | |||
| */ | |||
| @Service | |||
| public class StorageLocationServiceImpl extends ServiceImpl<StorageLocationMapper, StorageLocation> implements IStorageLocationService | |||
| { | |||
| /** | |||
| * 查询存储位置列表 | |||
| * | |||
| * @param form 存储位置 | |||
| * @return 存储位置 | |||
| */ | |||
| @Override | |||
| public List<StorageLocation> queryList(StorageLocation form) | |||
| { | |||
| QueryWrapper<StorageLocation> queryWrapper = Wrappers.query(); | |||
| queryWrapper.eq("s.del_flag", 0); | |||
| if(StringUtils.isNotEmpty(form.getName())) { | |||
| queryWrapper.like("s.name", form.getName()); | |||
| } | |||
| if(StringUtils.isNotEmpty(form.getLocation())) { | |||
| queryWrapper.like("s.location", form.getLocation()); | |||
| } | |||
| if(StringUtils.isNotEmpty(form.getShelfPlacement())) { | |||
| queryWrapper.like("s.shelf_placement", form.getShelfPlacement()); | |||
| } | |||
| if(form.getStatus() != null) { | |||
| queryWrapper.eq("s.status", form.getStatus()); | |||
| } | |||
| return baseMapper.queryList(queryWrapper); | |||
| } | |||
| } | |||
| @ -0,0 +1,16 @@ | |||
| <?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.hxhq.business.mapper.StorageLocationMapper"> | |||
| <select id="queryList" resultType="com.hxhq.business.domain.StorageLocation"> | |||
| SELECT s.*, d.dept_name as deptName | |||
| FROM `t_storage_location` s | |||
| LEFT JOIN `sys_dept` d on s.dept_id = d.dept_id | |||
| <if test="ew.sqlSegment != '' and ew.sqlSegment != null"> | |||
| <where> | |||
| ${ew.sqlSegment} | |||
| </where> | |||
| </if> | |||
| </select> | |||
| </mapper> | |||