parent
459296d64d
commit
7dc13d1e0d
@ -0,0 +1,25 @@ |
||||
package digital.laboratory.platform.reagent.controller; |
||||
|
||||
import digital.laboratory.platform.common.core.util.R; |
||||
import digital.laboratory.platform.reagent.entity.ReferenceMaterial; |
||||
import digital.laboratory.platform.reagent.service.ReferenceMaterialService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
@RestController |
||||
@RequestMapping("/reference/material") |
||||
public class ReferenceMaterialController { |
||||
|
||||
@Autowired |
||||
private ReferenceMaterialService referenceMaterialService; |
||||
|
||||
@PutMapping("/code") |
||||
public R<ReferenceMaterial> addCode(@RequestBody ReferenceMaterial referenceMaterial) { |
||||
|
||||
ReferenceMaterial material = referenceMaterialService.getById(referenceMaterial.getId()); |
||||
material.setCode(referenceMaterial.getCode()); |
||||
if (referenceMaterialService.updateById(material)) { |
||||
return R.ok(referenceMaterial, "录入条码信息成功"); |
||||
} else return R.failed(referenceMaterial, "录入条码信息出错"); |
||||
} |
||||
} |
@ -0,0 +1,28 @@ |
||||
package digital.laboratory.platform.reagent.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import digital.laboratory.platform.common.mybatis.base.BaseEntity; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
|
||||
@Data |
||||
@TableName(value = "location_info", autoResultMap = true) |
||||
@EqualsAndHashCode(callSuper = true) |
||||
@ApiModel(value = "(位置信息修改日志)") |
||||
public class LocationInfo extends BaseEntity { |
||||
|
||||
@TableId(value = "id",type = IdType.ASSIGN_ID) |
||||
private String id; |
||||
@ApiModelProperty(value = "物品批次ID") |
||||
private String batchDetailsId; |
||||
|
||||
@ApiModelProperty("上一次存放位置") |
||||
private String oldLocation; |
||||
|
||||
@ApiModelProperty(value = "新的存放位置") |
||||
private String newLocation; |
||||
} |
@ -0,0 +1,17 @@ |
||||
package digital.laboratory.platform.reagent.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import digital.laboratory.platform.reagent.entity.LocationInfo; |
||||
import digital.laboratory.platform.reagent.vo.LocationInfoVO; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.util.List; |
||||
|
||||
@Mapper |
||||
public interface LocationInfoMapper extends BaseMapper<LocationInfo> { |
||||
|
||||
public List<LocationInfoVO> getListById(@Param("batchDetailsId") String batchDetailsId); |
||||
} |
@ -0,0 +1,16 @@ |
||||
package digital.laboratory.platform.reagent.service; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import digital.laboratory.platform.reagent.entity.LocationInfo; |
||||
import digital.laboratory.platform.reagent.mapper.LocationInfoMapper; |
||||
import digital.laboratory.platform.reagent.vo.LocationInfoVO; |
||||
|
||||
import java.util.List; |
||||
|
||||
public interface LocationInfoService extends IService<LocationInfo> { |
||||
List<LocationInfoVO> getListById(String batchDetailsId); |
||||
|
||||
boolean addInfo(String batchDetailsId, String oldLocation, String newLocation); |
||||
} |
@ -0,0 +1,33 @@ |
||||
package digital.laboratory.platform.reagent.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import digital.laboratory.platform.reagent.entity.LocationInfo; |
||||
import digital.laboratory.platform.reagent.mapper.LocationInfoMapper; |
||||
import digital.laboratory.platform.reagent.service.LocationInfoService; |
||||
import digital.laboratory.platform.reagent.vo.LocationInfoVO; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.List; |
||||
|
||||
@Service |
||||
public class LocationServiceImpl extends ServiceImpl<LocationInfoMapper, LocationInfo> implements LocationInfoService { |
||||
|
||||
@Override |
||||
public List<LocationInfoVO> getListById(String batchDetailsId) { |
||||
return baseMapper.getListById(batchDetailsId); |
||||
} |
||||
|
||||
@Override |
||||
public boolean addInfo(String batchDetailsId, String oldLocation, String newLocation) { |
||||
LocationInfo locationInfo = new LocationInfo(); |
||||
locationInfo.setNewLocation(newLocation); |
||||
locationInfo.setOldLocation(oldLocation); |
||||
locationInfo.setBatchDetailsId(batchDetailsId); |
||||
locationInfo.setId(IdWorker.get32UUID().toUpperCase()); |
||||
return this.save(locationInfo); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,9 @@ |
||||
package digital.laboratory.platform.reagent.vo; |
||||
|
||||
import digital.laboratory.platform.reagent.entity.LocationInfo; |
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class LocationInfoVO extends LocationInfo { |
||||
private String userName; |
||||
} |
@ -0,0 +1,32 @@ |
||||
<?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="digital.laboratory.platform.reagent.mapper.LocationInfoMapper"> |
||||
|
||||
<resultMap id="locationInfoMap" type="digital.laboratory.platform.reagent.entity.LocationInfo"> |
||||
<id property="id" column="id"></id> |
||||
<result property="batchDetailsId" column="batch_details_id"></result> |
||||
<result property="oldLocation" column="old_location"></result> |
||||
<result property="newLocation" column="new_location"></result> |
||||
<result property="createTime" column="create_time"/> |
||||
<result property="updateTime" column="update_time"/> |
||||
<result property="createBy" column="create_by"/> |
||||
<result property="updateBy" column="update_by"/> |
||||
</resultMap> |
||||
|
||||
<resultMap id="locationInfoVO" type="digital.laboratory.platform.reagent.vo.LocationInfoVO" |
||||
extends="locationInfoMap"> |
||||
<result property="userName" column="user_name"></result> |
||||
</resultMap> |
||||
|
||||
<select id="getListById" resultMap="locationInfoVO"> |
||||
select li.*, |
||||
(select u.name from dlp_base.sys_user u where u.user_id = li.create_by) as user_name |
||||
from location_info li |
||||
where batch_details_id = #{batchDetailsId} |
||||
order by create_time desc |
||||
|
||||
</select> |
||||
|
||||
</mapper> |
Loading…
Reference in new issue