| | |
| | | import com.yuanchu.limslaboratory.pojo.Inspection; |
| | | import com.yuanchu.limslaboratory.pojo.InspectionProductList; |
| | | import com.yuanchu.limslaboratory.pojo.Product; |
| | | import com.yuanchu.limslaboratory.service.InspectionProductListService; |
| | | import com.yuanchu.limslaboratory.service.InspectionService; |
| | | import com.yuanchu.limslaboratory.service.ProductService; |
| | | import com.yuanchu.limslaboratory.service.SpecificationsService; |
| | | import com.yuanchu.limslaboratory.service.*; |
| | | import com.yuanchu.limslaboratory.utils.JackSonUtil; |
| | | import com.yuanchu.limslaboratory.utils.RedisUtil; |
| | | import com.yuanchu.limslaboratory.vo.Result; |
| | | import io.swagger.annotations.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestHeader; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | |
| | | private InspectionService inspectionService; |
| | | |
| | | @Autowired |
| | | private ProductService productService; |
| | | |
| | | @Autowired |
| | | private SpecificationsService specificationsService; |
| | | private InspectionMaterialListService inspectionMaterialListService; |
| | | |
| | | @Autowired |
| | | private InspectionProductListService inspectionProductListService; |
| | | |
| | | @Autowired |
| | | private MaterialService materialService; |
| | | |
| | | @ApiOperation("æ·»å æ£éªç³è¯·å") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "materialId", value = "ç©æä¿¡æ¯id", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "type", value = "æ£éªç±»å", dataTypeClass = Integer.class, required = true), |
| | | }) |
| | | @PostMapping("/addInspection") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Result addInspection(@RequestHeader("X-Token") String token, int materialId,int type) throws Exception { |
| | | List<Product> list = productService.selectProductByMaterialId(materialId); |
| | | Map<String, Object> map = specificationsService.selectSNameSNName(materialId); |
| | | if (map==null)return Result.fail("æ¾ä¸å°è¯¥ç©æä¿¡æ¯"); |
| | | public Result addInspection(@RequestHeader("X-Token") String token, int type) throws Exception { |
| | | Object object = RedisUtil.get(token); |
| | | Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(object), Map.class); |
| | | Inspection inspection = new Inspection(); |
| | | inspection.setId(IdWorker.getIdStr()) |
| | | .setType(type) |
| | | .setInspectionStatus(0) |
| | | .setState(1) |
| | | .setVersion(1) |
| | | .setUserName("" + unmarshal.get("name")) |
| | | .setMaterialNum(Integer.valueOf("" + map.get("num"))) |
| | | .setMaterialSupplier("" + map.get("supplier")) |
| | | .setMaterialName("" + map.get("m_name")) |
| | | .setMaterialLocation("" + map.get("location")) |
| | | .setMaterialBatch("" + map.get("batch")) |
| | | .setMaterialReelNumber("" + map.get("reel_number")) |
| | | .setSpecificationsSerialNumber("" + map.get("ss_name")) |
| | | .setSpecificationsVoltageLevel("" + map.get("voltage_level")) |
| | | .setSpecificationsCrossSection("" + map.get("cross_section")) |
| | | .setSpecificationsNumberOfCores("" + map.get("number_of_cores")) |
| | | .setSpecificationsInstruct("" + map.get("instruct")); |
| | | int judge1 = 0; |
| | | int judge2 = 0; |
| | | try { |
| | | judge1 = inspectionService.addInspection(inspection); |
| | | List<InspectionProductList> list2 = new ArrayList<>(); |
| | | list.forEach(a -> { |
| | | InspectionProductList inspectionProductList = new InspectionProductList(); |
| | | inspectionProductList.setName(a.getName()) |
| | | .setMethod(a.getMethod()) |
| | | .setUnit(a.getUnit()) |
| | | .setRequired(a.getRequired()) |
| | | .setInternal(a.getInternal()) |
| | | .setState(1) |
| | | .setVersion(1) |
| | | .setInspectionId(inspection.getId()) |
| | | .setUserId(Integer.parseInt("" + unmarshal.get("id"))) |
| | | .setCreateTime(new Date()) |
| | | .setUpdateTime(new Date()); |
| | | list2.add(inspectionProductList); |
| | | }); |
| | | judge2 = inspectionProductListService.addInspectionProductList(list2); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return Result.success(judge1 > 0 && judge2 > 0 ? "æäº¤æå" : "æäº¤å¤±è´¥", judge1 > 0 && judge2 > 0); |
| | | return Result.success(inspectionService.addInspection("" + unmarshal.get("name"), type)); |
| | | } |
| | | |
| | | @ApiOperation("æ¥è¯¢æææ£éªåå表") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "pageSize", value = "页æ°", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "countSize", value = "æ¡æ°/页", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "state", value = "ç¶æ(为空=å
¨é¨)", dataTypeClass = Integer.class) |
| | | }) |
| | | @GetMapping("/selectAllInspection") |
| | | public Result selectAllInspection(int pageSize, int countSize, Integer state) { |
| | | return Result.success(inspectionService.selectAllInspection(pageSize, countSize, state)); |
| | | } |
| | | |
| | | @ApiOperation("æ¥è¯¢æ£éªåéé¢çç©æä¿¡æ¯") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "inspectionId", value = "æ¥æ£åID", dataTypeClass = String.class, required = true), |
| | | }) |
| | | @PostMapping("/selectMaterialByInsId") |
| | | public Result selectMaterialByInsId(String inspectionId) { |
| | | return Result.success(inspectionMaterialListService.selectInspectionMaterialListByInsId(inspectionId)); |
| | | } |
| | | |
| | | @ApiOperation("æ¥è¯¢ç©æä¿¡æ¯") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "pageSize", value = "页æ°", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "countSize", value = "æ¡æ°/页", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @GetMapping("/selectMaterialLimit") |
| | | public Result selectMaterialLimit(int pageSize, int countSize) { |
| | | return Result.success(materialService.selectMaterialLimit(pageSize, countSize)); |
| | | } |
| | | |
| | | @ApiOperation("éæ©ç©æä¿¡æ¯") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "materialId", value = "ç©æID", dataTypeClass = Integer.class, required = true), |
| | | }) |
| | | @PostMapping("/selectMaterialById") |
| | | public Result selectMaterialById(String materialId) { |
| | | return Result.success(materialService.selectMaterialById(materialId)); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
| | | import com.yuanchu.limslaboratory.pojo.InspectionMaterialList; |
| | | import com.yuanchu.limslaboratory.pojo.Material; |
| | | import com.yuanchu.limslaboratory.service.InspectionMaterialListService; |
| | | import com.yuanchu.limslaboratory.utils.JackSonUtil; |
| | | import com.yuanchu.limslaboratory.utils.RedisUtil; |
| | | import com.yuanchu.limslaboratory.vo.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-07-17 |
| | | */ |
| | | @Api(tags = "æ£éªæ¨¡å") |
| | | @RestController |
| | | @RequestMapping("/inspectionMaterialList") |
| | | public class InspectionMaterialListController { |
| | | |
| | | @Autowired |
| | | InspectionMaterialListService inspectionMaterialListService; |
| | | |
| | | @ApiOperation("æ·»å æ ·å") |
| | | @PostMapping("/addInspectionMaterialList") |
| | | public Result addInspectionMaterialList(@RequestHeader("X-Token") String token, @RequestBody InspectionMaterialList inspectionMaterialList) throws Exception { |
| | | inspectionMaterialList.setState(1); |
| | | Object object = RedisUtil.get(token); |
| | | Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(object), Map.class); |
| | | return Result.success(inspectionMaterialListService.addInspectionMaterialList(inspectionMaterialList, ""+unmarshal.get("id"))); |
| | | } |
| | | |
| | | @ApiOperation("å 餿 ·å") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "inspectionMaterialListId", value = "æ ·åID", dataTypeClass = Integer.class, required = true), |
| | | }) |
| | | @PostMapping("/delInspectionMaterialList") |
| | | public Result delInspectionMaterialList(int inspectionMaterialListId) { |
| | | return Result.success(inspectionMaterialListService.delInspectionMaterialListByInsId(inspectionMaterialListId)); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.yuanchu.limslaboratory.controller; |
| | | |
| | | |
| | | import com.yuanchu.limslaboratory.vo.Result; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | |
| | | @RequestMapping("/inspection-product-list") |
| | | public class InspectionProductListController { |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | import com.yuanchu.limslaboratory.pojo.Inspection; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.yuanchu.limslaboratory.pojo.dto.InspectionDto; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | */ |
| | | public interface InspectionMapper extends BaseMapper<Inspection> { |
| | | |
| | | List<InspectionDto> selectAllInspection(int pageSize, int countSize, Integer state); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.yuanchu.limslaboratory.pojo.InspectionMaterialList; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-07-17 |
| | | */ |
| | | public interface InspectionMaterialListMapper extends BaseMapper<InspectionMaterialList> { |
| | | |
| | | List<InspectionMaterialList> selectInspectionMaterialListByInsId(String insId); |
| | | |
| | | } |
| | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Data |
| | | @Accessors(chain = true) |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @ApiModel(value="Inspection对象", description="") |
| | | public class Inspection implements Serializable { |
| | |
| | | @ApiModelProperty(value = "æ£éªç»ææ¥æ") |
| | | private LocalDateTime inspectEndTime; |
| | | |
| | | @ApiModelProperty(value = "æ¥æ£æ°é-ç©ææ°é") |
| | | private Integer materialNum; |
| | | |
| | | @ApiModelProperty(value = "ä¾åºå") |
| | | private String materialSupplier; |
| | | |
| | | @ApiModelProperty(value = "ç©æåç§°") |
| | | private String materialName; |
| | | |
| | | @ApiModelProperty(value = "ç©æåæ¾å°") |
| | | private String materialLocation; |
| | | |
| | | @ApiModelProperty(value = "ç©ææ¹æ¬¡") |
| | | private String materialBatch; |
| | | |
| | | @ApiModelProperty(value = "ç©æçå·") |
| | | private String materialReelNumber; |
| | | |
| | | @ApiModelProperty(value = "è§æ ¼åç§°/åå·åç§°") |
| | | private String specificationsSerialNumber; |
| | | |
| | | @ApiModelProperty(value = "çµåç级") |
| | | private String specificationsVoltageLevel; |
| | | |
| | | @ApiModelProperty(value = "ä¸»çº¿å¿æªé¢") |
| | | private String specificationsCrossSection; |
| | | |
| | | @ApiModelProperty(value = "主线è¯è¯æ°") |
| | | private String specificationsNumberOfCores; |
| | | |
| | | @ApiModelProperty(value = "ç产æä»¤å·") |
| | | private String specificationsInstruct; |
| | | |
| | | |
| | | public Inspection(Integer type, Integer inspectionStatus, Integer state, Integer version, String userName) { |
| | | this.type = type; |
| | | this.inspectionStatus = inspectionStatus; |
| | | this.state = state; |
| | | this.version = version; |
| | | this.userName = userName; |
| | | } |
| | | } |
| | |
| | | private Integer version; |
| | | |
| | | @ApiModelProperty(value = "å
³è æ¥æ£id") |
| | | private String inspectionId; |
| | | private int inspectionMaterialListId; |
| | | |
| | | @ApiModelProperty(value = "å
³è ç¨æ·id è¯éªå") |
| | | private Integer userId; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.pojo.dto; |
| | | |
| | | import com.yuanchu.limslaboratory.pojo.Inspection; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | public class InspectionDto extends Inspection implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | @ApiModelProperty(value = "æ£éªäººåç§°") |
| | | private String inspectUserName; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.yuanchu.limslaboratory.pojo.InspectionMaterialList; |
| | | import com.yuanchu.limslaboratory.pojo.Plan; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-07-17 |
| | | */ |
| | | public interface InspectionMaterialListService extends IService<InspectionMaterialList> { |
| | | List<InspectionMaterialList> selectInspectionMaterialListByInsId(String insId); |
| | | |
| | | InspectionMaterialList addInspectionMaterialList(InspectionMaterialList inspectionMaterialList,String userId); |
| | | |
| | | boolean delInspectionMaterialListByInsId(int inspectionMaterialListId); |
| | | |
| | | } |
| | |
| | | |
| | | int addInspectionProductList(List<InspectionProductList> list); |
| | | |
| | | int delInspectionProductList(int inspectionMaterialListId); |
| | | |
| | | } |
| | |
| | | |
| | | import com.yuanchu.limslaboratory.pojo.Inspection; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.yuanchu.limslaboratory.pojo.dto.InspectionDto; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | */ |
| | | public interface InspectionService extends IService<Inspection> { |
| | | |
| | | int addInspection(Inspection inspection); |
| | | Inspection addInspection(String userName,int type); |
| | | |
| | | List<InspectionDto> selectAllInspection(int pageSize, int countSize, Integer state); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.limslaboratory.mapper.InspectionMaterialListMapper; |
| | | import com.yuanchu.limslaboratory.mapper.InspectionProductListMapper; |
| | | import com.yuanchu.limslaboratory.mapper.PlanMapper; |
| | | import com.yuanchu.limslaboratory.mapper.ProductMapper; |
| | | import com.yuanchu.limslaboratory.pojo.InspectionMaterialList; |
| | | import com.yuanchu.limslaboratory.pojo.InspectionProductList; |
| | | import com.yuanchu.limslaboratory.pojo.Plan; |
| | | import com.yuanchu.limslaboratory.pojo.Product; |
| | | import com.yuanchu.limslaboratory.service.InspectionMaterialListService; |
| | | import com.yuanchu.limslaboratory.service.InspectionProductListService; |
| | | import com.yuanchu.limslaboratory.service.PlanService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-07-17 |
| | | */ |
| | | @Service |
| | | public class InspectionMaterialListServiceImpl extends ServiceImpl<InspectionMaterialListMapper, InspectionMaterialList> implements InspectionMaterialListService { |
| | | |
| | | @Resource |
| | | InspectionMaterialListMapper inspectionMaterialListMapper; |
| | | |
| | | @Resource |
| | | ProductMapper productMapper; |
| | | |
| | | @Resource |
| | | InspectionProductListMapper inspectionProductListMapper; |
| | | |
| | | @Override |
| | | public List<InspectionMaterialList> selectInspectionMaterialListByInsId(String insId) { |
| | | return inspectionMaterialListMapper.selectInspectionMaterialListByInsId(insId); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public InspectionMaterialList addInspectionMaterialList(InspectionMaterialList inspectionMaterialList,String userId) { |
| | | int judge = inspectionMaterialListMapper.insert(inspectionMaterialList); |
| | | List<Product> list = productMapper.selectProductByMaterialId(inspectionMaterialList.getMaterialId()); |
| | | List<InspectionProductList> list1 = new ArrayList<>(); |
| | | list.forEach(a-> { |
| | | InspectionProductList inspectionProductList = new InspectionProductList(); |
| | | inspectionProductList.setName(a.getName()) |
| | | .setMethod(a.getMethod()) |
| | | .setUnit(a.getUnit()) |
| | | .setRequired(a.getRequired()) |
| | | .setInternal(a.getInternal()) |
| | | .setState(1) |
| | | .setInspectionMaterialListId(inspectionMaterialList.getId()) |
| | | .setUserId(Integer.parseInt(userId)); |
| | | list1.add(inspectionProductList); |
| | | }); |
| | | int judge2 = inspectionProductListMapper.addInspectionProductList(list1); |
| | | return judge>0&&judge2>0?inspectionMaterialList:null; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean delInspectionMaterialListByInsId(int inspectionMaterialListId) { |
| | | InspectionMaterialList list = new InspectionMaterialList(); |
| | | list.setState(0); |
| | | list.setId(inspectionMaterialListId); |
| | | int judge1 = inspectionMaterialListMapper.updateById(list); |
| | | UpdateWrapper<InspectionProductList> wrapper = new UpdateWrapper<>(); |
| | | wrapper.eq("inspection_material_list_id", inspectionMaterialListId).set("state", 0); |
| | | int judge2 = inspectionProductListMapper.update(new InspectionProductList(), wrapper); |
| | | return judge1>0&&judge2>0; |
| | | } |
| | | } |
| | |
| | | package com.yuanchu.limslaboratory.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.yuanchu.limslaboratory.pojo.InspectionProductList; |
| | | import com.yuanchu.limslaboratory.mapper.InspectionProductListMapper; |
| | | import com.yuanchu.limslaboratory.pojo.Product; |
| | |
| | | public int addInspectionProductList(List<InspectionProductList> list) { |
| | | return inspectionProductListMapper.addInspectionProductList(list); |
| | | } |
| | | |
| | | @Override |
| | | public int delInspectionProductList(int inspectionMaterialListId) { |
| | | UpdateWrapper<InspectionProductList> wrapper = new UpdateWrapper<>(); |
| | | wrapper.eq("inspectionMaterialListId", inspectionMaterialListId).set("state", 0); |
| | | return inspectionProductListMapper.update(new InspectionProductList(),wrapper); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.yuanchu.limslaboratory.pojo.Inspection; |
| | | import com.yuanchu.limslaboratory.mapper.InspectionMapper; |
| | | import com.yuanchu.limslaboratory.pojo.dto.InspectionDto; |
| | | import com.yuanchu.limslaboratory.service.InspectionService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private InspectionMapper inspectionMapper; |
| | | |
| | | @Override |
| | | public int addInspection(Inspection inspection) { |
| | | return inspectionMapper.insert(inspection); |
| | | public Inspection addInspection(String userName,int type) { |
| | | Inspection inspection = new Inspection(type, 0,1,1, userName); |
| | | int judge = inspectionMapper.insert(inspection); |
| | | return judge>0?inspection:null; |
| | | } |
| | | |
| | | @Override |
| | | public List<InspectionDto> selectAllInspection(int pageSize, int countSize, Integer state) { |
| | | return inspectionMapper.selectAllInspection((pageSize - 1) * countSize,pageSize * countSize, state); |
| | | } |
| | | } |
| | |
| | | <?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.yuanchu.limslaboratory.mapper.InspectionMapper"> |
| | | |
| | | <select id="selectAllInspection" resultType="InspectionDto"> |
| | | select i.id, type, inspection_status, qualified_state, i.state, i.create_time, user_name, inspect_user_id, inspect_start_time, inspect_end_time, u.name inspectUserName |
| | | from inspection i left join user u |
| | | on i.inspect_user_id = u.id |
| | | <if test="state!=null"> |
| | | where state = #{state} |
| | | </if> |
| | | order by i.create_time desc |
| | | limit #{pageSize},#{countSize} |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.yuanchu.limslaboratory.mapper.InspectionMaterialListMapper"> |
| | | <select id="selectInspectionMaterialListByInsId" resultType="InspectionMaterialList"> |
| | | select id, |
| | | material_id, |
| | | material_num, |
| | | material_supplier, |
| | | material_name, |
| | | material_location, |
| | | material_batch, |
| | | material_reel_number, |
| | | specifications_serial_number, |
| | | specifications_voltage_level, |
| | | specifications_cross_section, |
| | | specifications_number_of_cores, |
| | | specifications_instruct, |
| | | notes |
| | | from inspection_material_list |
| | | where state = 1 |
| | | and inspection_id = #{insId} |
| | | </select> |
| | | </mapper> |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.yuanchu.limslaboratory.mapper.InspectionProductListMapper"> |
| | | <insert id="addInspectionProductList"> |
| | | INSERT INTO inspection_product_list (name, method, ask, unit, required, internal, create_time, update_time, inspection_id, user_id) VALUES |
| | | INSERT INTO inspection_product_list (name, method, ask, unit, required, internal, create_time, update_time,inspection_material_list_id, user_id) VALUES |
| | | <foreach collection="list" separator="," item="i"> |
| | | (#{i.name}, #{i.method}, #{i.ask}, #{i.unit}, #{i.required}, #{i.internal}, #{i.createTime}, #{i.updateTime}, #{i.inspectionId}, |
| | | (#{i.name}, #{i.method}, #{i.ask}, #{i.unit}, #{i.required}, #{i.internal}, #{i.createTime}, #{i.updateTime}, #{i.inspectionMaterialListId}, |
| | | #{i.userId}) |
| | | </foreach> |
| | | </insert> |
| | |
| | | import com.yuanchu.limslaboratory.pojo.Material; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper æ¥å£ |
| | |
| | | * @since 2023-07-17 |
| | | */ |
| | | public interface MaterialMapper extends BaseMapper<Material> { |
| | | List<Material> selectMaterialLimit(int num1,int num2); |
| | | |
| | | Map selectMaterialById(String materialId); |
| | | } |
| | |
| | | */ |
| | | public interface ProductMapper extends BaseMapper<Product> { |
| | | |
| | | List<Product> selectProductByMaterialId(int materialId); |
| | | List<Product> selectProductByMaterialId(String materialId); |
| | | |
| | | Map<String, Object> getProductInformation(Integer productId); |
| | | } |
| | |
| | | * @since 2023-07-17 |
| | | */ |
| | | public interface MaterialService extends IService<Material> { |
| | | List<Material> selectMaterialLimit(int pageSize,int countSize); |
| | | |
| | | Integer addMaterialInformation(Material material); |
| | | |
| | |
| | | * @return |
| | | */ |
| | | List<String> deleteMaterialEqSpecification(String specificationsId); |
| | | |
| | | Map selectMaterialById(String materialId); |
| | | } |
| | |
| | | public interface ProductService extends IService<Product> { |
| | | |
| | | /*éè¿ç©æidè·åç©æä¿¡åä¸å±ç项ç®å表*/ |
| | | List<Product> selectProductByMaterialId(int materialId); |
| | | List<Product> selectProductByMaterialId(String materialId); |
| | | |
| | | Integer addProductInformation(Product product); |
| | | |
| | |
| | | import com.yuanchu.limslaboratory.mapper.MaterialMapper; |
| | | import com.yuanchu.limslaboratory.service.MaterialService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.limslaboratory.utils.MyUtil; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | |
| | | public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> implements MaterialService { |
| | | |
| | | @Resource |
| | | private MaterialMapper materialMapper; |
| | | MaterialMapper materialMapper; |
| | | |
| | | @Override |
| | | public List<Material> selectMaterialLimit(int pageSize, int countSize) { |
| | | return materialMapper.selectMaterialLimit((pageSize - 1) * countSize,pageSize * countSize); |
| | | } |
| | | |
| | | @Override |
| | | public Map selectMaterialById(String materialId) { |
| | | return materialMapper.selectMaterialById(materialId); |
| | | } |
| | | |
| | | @Override |
| | | public Integer addMaterialInformation(Material material) { |
| | |
| | | private ProductMapper productMapper; |
| | | |
| | | @Override |
| | | public List<Product> selectProductByMaterialId(int materialId) { |
| | | public List<Product> selectProductByMaterialId(String materialId) { |
| | | return productMapper.selectProductByMaterialId(materialId); |
| | | } |
| | | |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.yuanchu.limslaboratory.mapper.MaterialMapper"> |
| | | |
| | | <select id="selectMaterialLimit" resultType="com.yuanchu.limslaboratory.pojo.Material"> |
| | | select id, name |
| | | from material |
| | | where state = 1 |
| | | order by create_time desc |
| | | limit #{num1},#{num2} |
| | | </select> |
| | | <select id="selectMaterialById" resultType="java.util.Map"> |
| | | select m.id, |
| | | m.num, |
| | | m.supplier, |
| | | m.name, |
| | | m.location, |
| | | m.batch, |
| | | m.reel_number reelNumber, |
| | | concat(s.name, '/', sn.name) specificationSerialNum, |
| | | s.voltage_level voltageLevel, |
| | | s.cross_section crossSection, |
| | | s.number_of_cores numberOfCores, |
| | | s.instruct |
| | | from material m, |
| | | specifications s, |
| | | serial_number sn |
| | | where m.specifications_id = s.id |
| | | and s.serial_id = sn.id |
| | | </select> |
| | | </mapper> |