Merge remote-tracking branch 'origin/master'
# Conflicts:
# inspection-server/src/main/java/com/yuanchu/limslaboratory/pojo/dto/InspectionDto.java
# inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/InspectionServiceImpl.java
# inspection-server/src/main/resources/mapper/InspectionMapper.xml
| | |
| | | |
| | | /** |
| | | * <p> |
| | | * å端æ§å¶å¨ |
| | | * å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | |
| | | 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"))); |
| | | return Result.success(inspectionMaterialListService.addInspectionMaterialList(inspectionMaterialList, "" + unmarshal.get("id"))); |
| | | } |
| | | |
| | | @ApiOperation("å 餿 ·å") |
| | |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "inspectionMaterialListId", value = "æ ·åID", dataTypeClass = Integer.class, required = true), |
| | | }) |
| | | @PostMapping("/selectInspectionMaterialListById") |
| | | public Result selectInspectionMaterialListById(int inspectionMaterialListId) throws Exception { |
| | | @PutMapping("/selectInspectionMaterialListById/{inspectionMaterialListId}") |
| | | public Result selectInspectionMaterialListById(@PathVariable Integer inspectionMaterialListId) { |
| | | return Result.success(inspectionMaterialListService.getById(inspectionMaterialListId)); |
| | | } |
| | | |
| | |
| | | @ApiImplicitParam(name = "inspectionMaterialListId", value = "æ ·åID", dataTypeClass = Integer.class, required = true), |
| | | }) |
| | | @PutMapping("/updateInspectionMaterialList/{inspectionMaterialListId}") |
| | | public Result updateInspectionMaterialList(@PathVariable Integer inspectionMaterialListId, @RequestBody InspectionMaterialList inspectionMaterialList) throws Exception { |
| | | return Result.success(inspectionMaterialListService.updateInspectionMaterialList(inspectionMaterialListId,inspectionMaterialList)); |
| | | public Result updateInspectionMaterialList(@PathVariable Integer inspectionMaterialListId, @RequestBody InspectionMaterialList inspectionMaterialList) { |
| | | return Result.success(inspectionMaterialListService.updateInspectionMaterialList(inspectionMaterialListId, inspectionMaterialList)); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.yuanchu.limslaboratory.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import com.yuanchu.limslaboratory.pojo.Plan; |
| | | import com.yuanchu.limslaboratory.service.PlanService; |
| | | 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.web.bind.annotation.*; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-07-17 |
| | | */ |
| | | @Api(tags = "æ£éªæ¨¡å") |
| | | @RestController |
| | | @RequestMapping("/plan") |
| | | public class PlanController { |
| | | |
| | | @Resource |
| | | private PlanService planService; |
| | | |
| | | @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("/selectAllPlan") |
| | | public Result selectAllPlan(int pageSize, int countSize, Integer state) { |
| | | return Result.success(planService.selectAllPlan(pageSize, countSize, state)); |
| | | } |
| | | |
| | | @ApiOperation("æ¥è¯¢æ£éªè®¡åéé¢çåé
ä¿¡æ¯") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "id", value = "æ ·åç¼å·", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @PutMapping("/selectPlanById/{id}") |
| | | public Result selectPlanById(@PathVariable Integer id) { |
| | | return Result.success(planService.selectById(id)); |
| | | } |
| | | |
| | | @ApiOperation("ä½åºæ£éªè®¡å") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "id", value = "æ£éªè®¡åID", dataTypeClass = Integer.class, required = true), |
| | | }) |
| | | @PostMapping("/delPlan") |
| | | public Result delPlan(Integer id) { |
| | | return Result.success(planService.delPlan(id)); |
| | | } |
| | | } |
| | |
| | | |
| | | int addInspectionProductList(List<InspectionProductList> list); |
| | | |
| | | //æ ¹æ®æ ·åidæ¥è¯¢æ£éªé¡¹ç® |
| | | List<InspectionProductList> selectByMaterId(Integer id); |
| | | } |
| | |
| | | |
| | | import com.yuanchu.limslaboratory.pojo.Plan; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.yuanchu.limslaboratory.pojo.dto.PlanDto; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface PlanMapper extends BaseMapper<Plan> { |
| | | |
| | | List<PlanDto> selectAllPlan(int pageSize, int countSize, Integer state); |
| | | } |
| | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.*; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @since 2023-07-17 |
| | | */ |
| | | @Data |
| | | @Accessors(chain = true) |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | @Builder |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @ApiModel(value="Plan对象", description="") |
| | | public class Plan implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @ApiModelProperty(value = "计åç¼å·") |
| | | private Integer id; |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.pojo.dto; |
| | | |
| | | |
| | | import com.yuanchu.limslaboratory.pojo.Plan; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | public class PlanDto extends Plan implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "æ¥æ£ç±»å") |
| | | private Integer type; |
| | | @ApiModelProperty(value = "æ¥æ£äºº") |
| | | private String userName; |
| | | } |
| | |
| | | package com.yuanchu.limslaboratory.service; |
| | | |
| | | import com.yuanchu.limslaboratory.pojo.InspectionProductList; |
| | | import com.yuanchu.limslaboratory.pojo.Plan; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.yuanchu.limslaboratory.pojo.dto.PlanDto; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface PlanService extends IService<Plan> { |
| | | |
| | | List<PlanDto> selectAllPlan(int pageSize, int countSize, Integer state); |
| | | |
| | | boolean delPlan(Integer id); |
| | | |
| | | List<InspectionProductList> selectById(Integer id); |
| | | } |
| | |
| | | return judge>0&&judge2>0?inspectionMaterialList:null; |
| | | } |
| | | |
| | | //æ ¹æ®æ ·åidå 餿£éªæ ·å |
| | | @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; |
| | | } |
| | | |
| | | //ä¿®æ¹æ ·åä¿¡æ¯ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean updateInspectionMaterialList( Integer inspectionMaterialListId,InspectionMaterialList inspectionMaterialList) { |
| | | LambdaUpdateWrapper<InspectionMaterialList> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | //æ ¹æ®æ ·åidæ¥è¯¢ |
| | | updateWrapper.eq(InspectionMaterialList::getId,inspectionMaterialListId); |
| | | int judge = inspectionMaterialListMapper.update(inspectionMaterialList, updateWrapper); |
| | | return judge>0; |
| | |
| | | package com.yuanchu.limslaboratory.service.impl; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.yuanchu.limslaboratory.mapper.InspectionMaterialListMapper; |
| | | import com.yuanchu.limslaboratory.mapper.PlanMapper; |
| | | import com.yuanchu.limslaboratory.pojo.Inspection; |
| | | import com.yuanchu.limslaboratory.mapper.InspectionMapper; |
| | | import com.yuanchu.limslaboratory.pojo.InspectionMaterialList; |
| | | import com.yuanchu.limslaboratory.pojo.InspectionProductList; |
| | | import com.yuanchu.limslaboratory.pojo.Plan; |
| | | import com.yuanchu.limslaboratory.pojo.dto.InspectionDto; |
| | | import com.yuanchu.limslaboratory.service.InspectionService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | |
| | | @Resource |
| | | private InspectionMapper inspectionMapper; |
| | | @Resource |
| | | private PlanMapper planMapper; |
| | | @Resource |
| | | InspectionMaterialListMapper inspectionMaterialListMapper; |
| | | |
| | | @Override |
| | | public Inspection addInspection(String userName,int type) { |
| | |
| | | return judge>0?inspection:null; |
| | | } |
| | | |
| | | //æ¥è¯¢æææ£éªåå表 |
| | | @Override |
| | | public Map selectAllInspection(int pageSize, int countSize, Integer state) { |
| | | Map map = new HashMap(); |
| | |
| | | return map; |
| | | } |
| | | |
| | | //ä½åºç³è¯·æ£éªå |
| | | @Override |
| | | public boolean delInspectionByInsId(String inspectionId) { |
| | | Inspection inspection = new Inspection(); |
| | | //æ£éªåä½åº |
| | | Inspection inspection = inspectionMapper.selectById(inspectionId); |
| | | inspection.setState(0); |
| | | inspection.setId(inspectionId); |
| | | int judge = inspectionMapper.updateById(inspection); |
| | | return judge>0; |
| | | |
| | | int judge1 = inspectionMapper.updateById(inspection); |
| | | //æ£éªæ ·åä½åº |
| | | UpdateWrapper<InspectionMaterialList> wrapper = new UpdateWrapper<>(); |
| | | wrapper.eq("inspection_id", inspectionId).set("state", 0); |
| | | int judge2 = inspectionMaterialListMapper.update(new InspectionMaterialList(),wrapper); |
| | | return judge1>0&&judge2>0; |
| | | } |
| | | |
| | | //æäº¤ç³è¯·æ£éªå |
| | | @Override |
| | | public boolean subInspectionByInsId(String inspectionId) { |
| | | Inspection inspection = new Inspection(); |
| | | Inspection inspection = inspectionMapper.selectById(inspectionId); |
| | | //ç¶ææ¹ä¸ºå·²æäº¤2 |
| | | inspection.setState(2); |
| | | inspection.setId(inspectionId); |
| | | inspection.setInspectStartTime(LocalDateTime.now()); |
| | | int judge = inspectionMapper.updateById(inspection); |
| | | //计å表æ°å¢ |
| | | Plan plan = Plan.builder().inspectionId(inspectionId).state(1).build(); |
| | | planMapper.insert(plan); |
| | | return judge>0; |
| | | } |
| | | } |
| | |
| | | package com.yuanchu.limslaboratory.service.impl; |
| | | |
| | | import com.yuanchu.limslaboratory.mapper.InspectionMaterialListMapper; |
| | | import com.yuanchu.limslaboratory.mapper.InspectionProductListMapper; |
| | | import com.yuanchu.limslaboratory.pojo.InspectionMaterialList; |
| | | import com.yuanchu.limslaboratory.pojo.InspectionProductList; |
| | | import com.yuanchu.limslaboratory.pojo.Plan; |
| | | import com.yuanchu.limslaboratory.mapper.PlanMapper; |
| | | import com.yuanchu.limslaboratory.pojo.dto.PlanDto; |
| | | import com.yuanchu.limslaboratory.service.PlanService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements PlanService { |
| | | |
| | | @Resource |
| | | PlanMapper planMapper; |
| | | |
| | | @Resource |
| | | InspectionMaterialListMapper inspectionMaterialListMapper; |
| | | |
| | | @Resource |
| | | InspectionProductListMapper inspectionProductListMapper; |
| | | |
| | | //æ¥è¯¢æææ£éªè®¡å |
| | | @Override |
| | | public List<PlanDto> selectAllPlan(int pageSize, int countSize, Integer state) { |
| | | return planMapper.selectAllPlan((pageSize - 1) * countSize,pageSize * countSize, state); |
| | | } |
| | | |
| | | //ä½åºæ£éªè®¡å |
| | | @Override |
| | | public boolean delPlan(Integer id) { |
| | | Plan plan = planMapper.selectById(id); |
| | | //ç¶ææ¹ä¸ºä½åº0 |
| | | plan.setState(0); |
| | | int judge = planMapper.updateById(plan); |
| | | return judge>0; |
| | | } |
| | | |
| | | //æ¥è¯¢æ£éªè®¡åéé¢çåé
ä¿¡æ¯ |
| | | @Override |
| | | public List<InspectionProductList> selectById(Integer id) { |
| | | return inspectionProductListMapper.selectByMaterId(id); |
| | | } |
| | | } |
| | |
| | | <!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_material_list_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.inspectionMaterialListId}, |
| | | (#{i.name}, #{i.method}, #{i.ask}, #{i.unit}, #{i.required}, #{i.internal}, #{i.createTime}, |
| | | #{i.updateTime}, #{i.inspectionMaterialListId}, |
| | | #{i.userId}) |
| | | </foreach> |
| | | </insert> |
| | | |
| | | <select id="selectByMaterId" resultType="com.yuanchu.limslaboratory.pojo.InspectionProductList"> |
| | | select name,method,ask,unit,required,internal, start_time, end_time, user_id, instrument_id |
| | | from lims_laboratory.inspection_product_list |
| | | where inspection_material_list_id = #{id} |
| | | </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.PlanMapper"> |
| | | |
| | | <select id="selectAllPlan" resultType="com.yuanchu.limslaboratory.pojo.dto.PlanDto"> |
| | | select p.id,results,p.state,p.create_time,p.inspection_id,user_id,results,type,user_name |
| | | from lims_laboratory.plan p right join lims_laboratory.inspection i |
| | | on i.id=p.inspection_id |
| | | <if test="state!=null"> |
| | | where p.state = #{state} |
| | | </if> |
| | | order by p.create_time desc |
| | | limit #{pageSize},#{countSize} |
| | | </select> |
| | | </mapper> |