Merge remote-tracking branch 'origin/master'
# Conflicts:
# standard-server/src/main/resources/mapper/ProductMapper.xml
# user-server/src/main/java/com/yuanchu/limslaboratory/controller/RoleController.java
已修改27个文件
已删除2个文件
已添加13个文件
| | |
| | | <mapper namespace="com.yuanchu.limslaboratory.mapper.WorkMapper"> |
| | | <!--è´£ä»»äººé¡¹ç®æ°ç»è®¡--> |
| | | <select id="dutyMater" resultType="java.util.Map"> |
| | | select n.name, æªå®æ, 已宿 |
| | | from (select distinct user.name, count(inspection_product.id) 'æªå®æ' |
| | | select n.name, unfinish, finsh |
| | | from (select distinct user.name, count(inspection_product.id) unfinish |
| | | from lims_laboratory.inspection_product |
| | | left join lims_laboratory.user on inspection_product.user_pro_id = user.id |
| | | where state = 1 |
| | |
| | | and type = #{type} |
| | | and start_time between #{startTime} and #{endTime})) |
| | | group by user.name) n, |
| | | (select distinct user.name, count(inspection_product.id) '已宿' |
| | | (select distinct user.name, count(inspection_product.id) finsh |
| | | from lims_laboratory.inspection_product |
| | | left join lims_laboratory.user on inspection_product.user_pro_id = user.id |
| | | where state = 1 |
| | |
| | | |
| | | <!--æ§è¡äººé¡¹ç®æ°ç»è®¡--> |
| | | <select id="executeMater" resultType="java.util.Map"> |
| | | select n.name, æªå®æ, 已宿 |
| | | from (select distinct user.name, count(inspection_product.id) 'æªå®æ' |
| | | select n.name, unfinsh, finsh |
| | | from (select distinct user.name, count(inspection_product.id) unfinsh |
| | | from lims_laboratory.inspection_product |
| | | left join lims_laboratory.user on inspection_product.user_id = user.id |
| | | where state = 1 |
| | |
| | | and type = #{type} |
| | | and start_time between #{startTime} and #{endTime})) |
| | | group by user.name) n, |
| | | (select distinct user.name, count(inspection_product.id) '已宿' |
| | | (select distinct user.name, count(inspection_product.id) finsh |
| | | from lims_laboratory.inspection_product |
| | | left join lims_laboratory.user on inspection_product.user_id = user.id |
| | | where state = 1 |
| | |
| | | |
| | | <!--责任人æ§è¡ç--> |
| | | <select id="dutytimely" resultType="java.util.Map"> |
| | | select n.name, é¡¹ç®æ»æ°, åæ¶å®ææ° / é¡¹ç®æ»æ° * 100 'åæ¶ç' |
| | | from (select distinct user.name, count(inspection_product.id) 'é¡¹ç®æ»æ°' |
| | | select n.name, total, finshByTime / total * 100 timely |
| | | from (select distinct user.name, count(inspection_product.id) total |
| | | from lims_laboratory.inspection_product |
| | | left join lims_laboratory.user on inspection_product.user_pro_id = user.id |
| | | where state = 1 |
| | |
| | | and type = #{type} |
| | | and start_time between #{startTime} and #{endTime})) |
| | | group by user.name) n, |
| | | (select distinct user.name, count(inspection_product.id) '忶宿æ°' |
| | | (select distinct user.name, count(inspection_product.id) finshByTime |
| | | from lims_laboratory.inspection_product |
| | | left join lims_laboratory.user |
| | | on inspection_product.user_pro_id = user.id |
| | |
| | | |
| | | <!--æ§è¡äººåæ¶ç--> |
| | | <select id="executetimely" resultType="java.util.Map"> |
| | | select n.name, é¡¹ç®æ»æ°, åæ¶å®ææ° / é¡¹ç®æ»æ° * 100 'åæ¶ç' |
| | | from (select distinct user.name, count(inspection_product.id) 'é¡¹ç®æ»æ°' |
| | | select n.name, total, finshByTime / total * 100 timely |
| | | from (select distinct user.name, count(inspection_product.id) total |
| | | from lims_laboratory.inspection_product |
| | | left join lims_laboratory.user on inspection_product.user_id = user.id |
| | | where state = 1 |
| | |
| | | and type = #{type} |
| | | and start_time between #{startTime} and #{endTime})) |
| | | group by user.name) n, |
| | | (select distinct user.name, count(inspection_product.id) '忶宿æ°' |
| | | (select distinct user.name, count(inspection_product.id) finshByTime |
| | | from lims_laboratory.inspection_product |
| | | left join lims_laboratory.user |
| | | on inspection_product.user_id = user.id |
| | |
| | | |
| | | /** |
| | | * JSONè§£æå¤ç |
| | | * |
| | | * @author å¼ å®¾ |
| | | */ |
| | | @Component |
| | | public class JackSonUtil { |
| | |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.service.InspectionService; |
| | |
| | | return Result.fail("ç±»åé误!"); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ°å¢æ£éªå-->éæ©æ£éªé¡¹ç®çæ¬") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "name", value = "产ååç§°", dataTypeClass = String.class, required = true), |
| | | @ApiImplicitParam(name = "mcode", value = "产åç¼å·", dataTypeClass = String.class, required = true), |
| | | @ApiImplicitParam(name = "specifications", value = "è§æ ¼åå·", dataTypeClass = String.class, required = true) |
| | | }) |
| | | @GetMapping("/chooseVer") |
| | | public Result chooseVer(String name, String mcode, String specifications) { |
| | | return Result.success(inspectionService.chooseVer(name, mcode, specifications)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "æ°å¢æ£éªå") |
| | | @PostMapping("/addInspect") |
| | | public Result addInspect(@RequestHeader("token") String token, @RequestBody InspectionVo inspectionVo) throws Exception { |
| | | public Result addInspect(@RequestHeader("token") String token, @Validated @RequestBody InspectionVo inspectionVo) throws Exception { |
| | | Object object = RedisUtil.get(token); |
| | | Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(object), Map.class); |
| | | return Result.success(inspectionService.addInspect((Integer) unmarshal.get("id"), inspectionVo)); |
| | |
| | | } |
| | | |
| | | @ApiOperation(value = "ä¿åæ£éªé¡¹ç®è´£ä»»äºº") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "id", value = "æ£éªå项ç®id", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "userProId", value = "责任人id", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "id", value = "æ£éªå项ç®id", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "userProId", value = "责任人id", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @GetMapping("/chooseUseProId") |
| | | public Result chooseUseProId(Integer id,Integer userProId) { |
| | | return Result.success(inspectionService.chooseUseProId(id,userProId)); |
| | | public Result chooseUseProId(Integer id, Integer userProId) { |
| | | return Result.success(inspectionService.chooseUseProId(id, userProId)); |
| | | } |
| | | |
| | | @ApiOperation(value = "ä½åºæ£éªå") |
| | |
| | | @ApiImplicitParam(name = "id", value = "æ£éªåid", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @PostMapping("/delInspect") |
| | | public Result delInspect(Integer id) { |
| | | public Result delInspect(Integer id) { |
| | | return Result.success(inspectionService.delInspect(id)); |
| | | } |
| | | |
| | |
| | | map.put("row", linkBasicPage.getRecords()); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.yuanchu.limslaboratory.pojo.LinkBasicInformation; |
| | | import com.yuanchu.limslaboratory.pojo.LinkDetection; |
| | | import com.yuanchu.limslaboratory.pojo.Material; |
| | | import com.yuanchu.limslaboratory.service.LinkBasicInformationService; |
| | | import com.yuanchu.limslaboratory.service.MaterialService; |
| | | import com.yuanchu.limslaboratory.service.ProductService; |
| | | import com.yuanchu.limslaboratory.service.StandardService; |
| | | 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.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | @Autowired |
| | | private StandardService standardService; |
| | | |
| | | @Resource |
| | | ProductService productService; |
| | | |
| | | @ApiOperation("龿¥-->è·åæ ·ååç§°") |
| | | @GetMapping("/material") |
| | | public Result<?> getMaterialIdAndName(@RequestHeader("link") String link) { |
| | | String redisLink = RedisUtil.get("link").toString(); |
| | | if (redisLink.equals(link)){ |
| | | String redisLink = RedisUtil.get("viewId").toString(); |
| | | if (linkBasicInformationService.isIfViewUUID(redisLink)){ |
| | | LambdaQueryWrapper<Material> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.select(Material::getId, Material::getName, Material::getCode); |
| | | List<Map<String, Object>> maps = materialService.listMaps(wrapper); |
| | |
| | | @ApiOperation("龿¥-->è·åè§æ ¼åå·") |
| | | @GetMapping("/specification") |
| | | public Result<?> getSpecificationIdAndName(@RequestHeader("link") String link, String materialId) { |
| | | String redisLink = RedisUtil.get("link").toString(); |
| | | if (redisLink.equals(link)){ |
| | | String redisLink = RedisUtil.get("viewId").toString(); |
| | | if (linkBasicInformationService.isIfViewUUID(redisLink)){ |
| | | List<Map<String, Object>> specificationIdAndName = standardService.getSpecificationIdAndName(materialId); |
| | | return Result.success(specificationIdAndName); |
| | | } |
| | | return Result.fail("æ±æé¾æ¥é误æå·²è¿æï¼"); |
| | | } |
| | | |
| | | @ApiOperation("龿¥-->æ·»å æ£éªç³è¯·å") |
| | | @ApiOperation("龿¥-->éæ©è¯éªé¡¹ç®") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "modelId", value = "åå·id", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @GetMapping("/chooseProject") |
| | | public Result<?> chooseProject(@RequestHeader("link") String link, Integer modelId) { |
| | | String redisLink = RedisUtil.get("viewId").toString(); |
| | | if (linkBasicInformationService.isIfViewUUID(redisLink)){ |
| | | //æ¥è¯¢æ ååºä¸è¯¥åå·ä¸çææè¯éªé¡¹ç®(ç¶ç±») |
| | | return Result.success(productService.chooseProject(modelId)); |
| | | } |
| | | return Result.fail("æ±æé¾æ¥é误æå·²è¿æï¼"); |
| | | |
| | | } |
| | | |
| | | @ApiOperation("龿¥-->æ·»å å§ææ¥æ£ç³è¯·å") |
| | | @PostMapping("/addInspection") |
| | | public Result<?> addLinkBasicInformation(@RequestHeader("link") String link, @RequestBody LinkBasicInformation linkBasicInformation) { |
| | | String redisLink = RedisUtil.get("link").toString(); |
| | | if (redisLink.equals(link)){ |
| | | String redisLink = RedisUtil.get("viewId").toString(); |
| | | if (linkBasicInformationService.isIfViewUUID(redisLink)){ |
| | | linkBasicInformation.setUid(redisLink); |
| | | String code = linkBasicInformationService.addLinkBasicInformation(linkBasicInformation); |
| | | if (!ObjectUtils.isEmpty(code)){ |
| | | return Result.success("æ·»å æåï¼", code); |
| | |
| | | return Result.fail("æ±æé¾æ¥é误æå·²è¿æï¼"); |
| | | |
| | | } |
| | | |
| | | @ApiOperation(value = "çæäºç»´ç æéçå¯ä¸ç ") |
| | | @GetMapping("/getViewUUID") |
| | | public Result<?> getViewUUID(int day){ |
| | | return Result.success("çææå",linkBasicInformationService.getViewUUID(day)); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ¥è¯¢äºç»´ç æéçå¯ä¸ç ") |
| | | @GetMapping("/selectViewUUID") |
| | | public Result<?> selectViewUUID(){ |
| | | return Result.success("æ¥è¯¢æå",linkBasicInformationService.selectViewUUID()); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ£éªå¯ä¸ç æ¯å¦ææ") |
| | | @GetMapping("/isIfViewUUID") |
| | | public Result<?> isIfViewUUID(String viewId){ |
| | | return Result.success("æ¥è¯¢æå",linkBasicInformationService.isIfViewUUID(viewId)); |
| | | } |
| | | } |
| | |
| | | }) |
| | | @GetMapping("/selectAllPlan") |
| | | public Result selectAllPlan(String code, String beginTime, String endTime, Integer status) { |
| | | System.out.println(planService.selectAllPlan(code, beginTime, endTime, status).toString()); |
| | | return Result.success(planService.selectAllPlan(code, beginTime, endTime, status)); |
| | | } |
| | | |
| | |
| | | package com.yuanchu.limslaboratory.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "æ£éªä¿¡æ¯") |
| | | private List<LinkDetection> linkDetectionList; |
| | | |
| | | @ApiModelProperty(value = "çæidï¼ä½ç¨äºæææå
æ¥è¯¢å
容æç¨") |
| | | private String uid; |
| | | } |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date updateTime; |
| | | |
| | | @ApiModelProperty(value = "æ£éªæ¥æ", hidden = true) |
| | | @ApiModelProperty(value = "æ£éªæ¥æ", required = true,example = "2023-08-22") |
| | | private Date dateSurvey; |
| | | |
| | | @ApiModelProperty(value = "æ£éªç¶æ", hidden = true) |
| | |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | //æ°å¢æ£éªå |
| | |
| | | *æ£éªç±»å 0ï¼åææï¼1ï¼äº§åï¼2ï¼åæåï¼ |
| | | **/ |
| | | @JsonSerialize |
| | | @NotNull(message = "æ£éªç±»åä¸è½ä¸ºç©º") |
| | | private Integer type; |
| | | |
| | | /** |
| | |
| | | **/ |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | @NotBlank(message = "æ¥ææ¥æä¸è½ä¸ºç©º") |
| | | private Date formTime; |
| | | |
| | | /** |
| | | * ä¾åºå |
| | | **/ |
| | | @JsonSerialize |
| | | @NotBlank(message = "ä¾åºåä¸è½ä¸ºç©º") |
| | | private String supplier; |
| | | |
| | | /** |
| | | * ç©æç¼ç |
| | | **/ |
| | | @JsonSerialize |
| | | @NotBlank(message = "æ ·åç¼ç ä¸è½ä¸ºç©º") |
| | | private String mcode; |
| | | |
| | | /** |
| | | * ç©æåç§° |
| | | **/ |
| | | @JsonSerialize |
| | | @NotBlank(message = "æ ·ååç§°ä¸è½ä¸ºç©º") |
| | | private String name; |
| | | |
| | | /** |
| | | * è§æ ¼åç§°-åå·åç§° |
| | | **/ |
| | | @JsonSerialize |
| | | @NotBlank(message = "è§æ ¼åå·ä¸è½ä¸ºç©º") |
| | | private String specifications; |
| | | |
| | | /** |
| | |
| | | * æ¥æ£æ°é-ç©ææ°é |
| | | **/ |
| | | @JsonSerialize |
| | | @NotNull(message = "æ¥æ£æ°éä¸è½ä¸ºç©º") |
| | | private Integer num; |
| | | |
| | | /** |
| | |
| | | **/ |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | @NotBlank(message = "æ£éªå¼å§æ¶é´ä¸è½ä¸ºç©º") |
| | | private Date startTime; |
| | | |
| | | /** |
| | |
| | | **/ |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | @NotBlank(message = "æ£éªç»ææ¶é´ä¸è½ä¸ºç©º") |
| | | private Date endTime; |
| | | |
| | | //è¯éªé¡¹ç® |
| | | @NotBlank(message = "è¯éªé¡¹ç®ä¸è½ä¸ºç©º") |
| | | @JsonSerialize |
| | | private String experiment; |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | String chooseUseProId(Integer id, Integer userProId); |
| | | |
| | | /** |
| | | * æ°å¢æ£éªå-->éæ©æ£éªé¡¹ç®çæ¬ |
| | | * @param name |
| | | * @param mcode |
| | | * @param specifications |
| | | * @return |
| | | */ |
| | | List<Map<String,Object>> chooseVer(String name, String mcode, String specifications); |
| | | |
| | | } |
| | | |
| | |
| | | */ |
| | | List<Map<String, Object>> selectLinkAll(); |
| | | |
| | | String getViewUUID(int day); |
| | | |
| | | Map<String, String> selectViewUUID(); |
| | | |
| | | boolean isIfViewUUID(String uuid); |
| | | } |
| | |
| | | import cn.hutool.core.lang.Snowflake; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | .build(); |
| | | inspectionMaterialMapper.insert(inspectionMaterial); |
| | | /*æ°å¢æ£éªé¡¹ç®è¡¨*/ |
| | | //è·åç©æid |
| | | Material material = materialMapper.selectOne(Wrappers.<Material>query() |
| | | .eq("name", inspectionVo.getName()) |
| | | .eq("code", inspectionVo.getMcode())); |
| | | //è·åè§æ ¼åç§°ååå·åç§° |
| | | String specification = inspectionVo.getSpecifications(); |
| | | String[] split = specification.split("-"); |
| | | String stName = split[0]; |
| | | String spName = split[1]; |
| | | //è·åè§æ ¼id |
| | | Standard standard = standardService.getOne(Wrappers.<Standard>query() |
| | | .eq("name", stName) |
| | | .eq("material_id", material.getId())); |
| | | //è·ååå·id |
| | | Specifications specifications = specificationsService.getOne(Wrappers.<Specifications>query() |
| | | .eq("name", spName) |
| | | .eq("standard_id", standard.getId())); |
| | | //æ ¹æ®åå·idæ¥è¯¢é¡¹ç®ä¿¡æ¯ |
| | | List<Product> productList = productMapper.selectList(Wrappers.<Product>query().eq("specifications_id", specifications.getId())); |
| | | ArrayList<InspectionProduct> list = new ArrayList<>(); |
| | | for (Product product : productList) { |
| | | InspectionProduct rawInsProduct = InspectionProduct.builder() |
| | | .name(product.getName()) |
| | | .unit(product.getUnit()) |
| | | .required(product.getRequired()) |
| | | .internal(product.getInternal()) |
| | | .inspectionMaterialId(material.getId()) |
| | | .build(); |
| | | list.add(rawInsProduct); |
| | | //æ ¹æ®æ ·ååç§°ç¼å·ä»¥ååå·è§æ ¼è·ååå·id |
| | | Integer specificationId = getSpecificationId(inspectionVo.getName(), inspectionVo.getMcode(), inspectionVo.getSpecifications()); |
| | | //妿è¯éªé¡¹ç®å段ä¸ä¸ºç©º |
| | | if (ObjectUtils.isNotEmpty(inspectionVo.getExperiment())) { |
| | | //è·åè¯éªé¡¹ç®ä¿¡æ¯(ç»æ,导线å¤å¾) |
| | | List<String> experiments = Arrays.stream(inspectionVo.getExperiment().split(",")).collect(Collectors.toList()); |
| | | //æ ¹æ®åå·idå项ç®ä¿¡æ¯æ¥è¯¢é¡¹ç®ä¿¡æ¯ |
| | | List<Product> products = new ArrayList<>(); |
| | | for (String experiment : experiments) { |
| | | List<Product> productList1 = productMapper.selectList(Wrappers.<Product>query() |
| | | .eq("specifications_id", specificationId) |
| | | .eq("father", experiment)); |
| | | if (ObjectUtils.isEmpty(productList1)) { |
| | | Product product = productMapper.selectOne(Wrappers.<Product>query() |
| | | .eq("specifications_id", specificationId) |
| | | .isNull("father") |
| | | .eq("name", experiment)); |
| | | products.add(product); |
| | | } else products.addAll(productList1); |
| | | } |
| | | |
| | | //å°æ¥è¯¢ç项ç®ä¿¡æ¯æå»ºææ£éªé¡¹ç® |
| | | ArrayList<InspectionProduct> list = new ArrayList<>(); |
| | | for (Product product : products) { |
| | | InspectionProduct rawInsProduct = InspectionProduct.builder() |
| | | .name(product.getName()) |
| | | .unit(product.getUnit()) |
| | | .required(product.getRequired()) |
| | | .internal(product.getInternal()) |
| | | .inspectionMaterialId(inspectionMaterial.getId()) |
| | | .build(); |
| | | list.add(rawInsProduct); |
| | | } |
| | | |
| | | //æ£éªé¡¹ç®æ¹éæ·»å |
| | | inspectionProductService.saveBatch(list); |
| | | return inspection.getId(); |
| | | } |
| | | //æ£éªé¡¹ç®æ¹éæ·»å |
| | | inspectionProductService.saveBatch(list); |
| | | return inspection.getId(); |
| | | //todo:æªå® |
| | | return null; |
| | | } |
| | | |
| | | //æ ¹æ®æ£éªåidæ¥è¯¢åæææ£éªå详æ
|
| | |
| | | } |
| | | |
| | | |
| | | //æ°å¢æ£éªå-->éæ©æ£éªé¡¹ç®çæ¬ |
| | | @Override |
| | | public List<Map<String, Object>> chooseVer(String name, String mcode, String specifications) { |
| | | Integer specificationId = getSpecificationId(name, mcode, specifications); |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /*æ ¹æ®æ ·ååç§°,æ ·åç¼å·,åå·è§æ ¼è·ååå·id*/ |
| | | private Integer getSpecificationId(String name, String mcode, String specification) { |
| | | //è·åç©æid |
| | | Material material = materialMapper.selectOne(Wrappers.<Material>query() |
| | | .eq("name", name) |
| | | .eq("code", mcode)); |
| | | //è·åè§æ ¼åç§°ååå·åç§° |
| | | String[] split = specification.split("-"); |
| | | String stName = split[0]; |
| | | String spName = split[1]; |
| | | //è·åè§æ ¼id |
| | | Standard standard = standardService.getOne(Wrappers.<Standard>query() |
| | | .eq("name", stName) |
| | | .eq("material_id", material.getId())); |
| | | //è·ååå·id |
| | | Specifications specifications = specificationsService.getOne(Wrappers.<Specifications>query() |
| | | .eq("name", spName) |
| | | .eq("standard_id", standard.getId())); |
| | | return specifications.getId(); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.pojo.LinkBasicInformation; |
| | | import com.yuanchu.limslaboratory.mapper.LinkBasicInformationMapper; |
| | | import com.yuanchu.limslaboratory.pojo.vo.InspectionVo; |
| | | import com.yuanchu.limslaboratory.service.LinkBasicInformationService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.limslaboratory.service.LinkDetectionService; |
| | | import com.yuanchu.limslaboratory.utils.MyUtil; |
| | | import com.yuanchu.limslaboratory.utils.RedisUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * <p> |
| | | * æå¡å®ç°ç±» |
| | | * æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | |
| | | |
| | | @Override |
| | | public String addLinkBasicInformation(LinkBasicInformation linkBasicInformation) { |
| | | String code = MyUtil.getTimeSixNumberCode("SL","SL"); |
| | | //å§æç¼å· |
| | | String code = MyUtil.getTimeSixNumberCode("SL", "SL"); |
| | | linkBasicInformation.setEntrustCoding(code); |
| | | //æ°å¢åºæ¬ä¿¡æ¯è¡¨ |
| | | int insert = linkBasicInformationMapper.insert(linkBasicInformation); |
| | | if (insert == 1) { |
| | | //æ°å¢å§ææ ·å表 |
| | | linkDetectionService.insertListData(linkBasicInformation.getId(), linkBasicInformation.getLinkDetectionList()); |
| | | return code; |
| | | } |
| | |
| | | return linkBasicInformationMapper.selectLinkAll(); |
| | | } |
| | | |
| | | @Override |
| | | public String getViewUUID(int day) { |
| | | String id = String.valueOf(UUID.randomUUID()); |
| | | RedisUtil.set("viewId", id, day * 24 * 60); |
| | | return id; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, String> selectViewUUID() { |
| | | Map<String, String> map = new HashMap<>(); |
| | | try { |
| | | map.put("id", RedisUtil.get("viewId").toString()); |
| | | map.put("time", String.valueOf(RedisUtil.getExpire("viewId"))); |
| | | } catch (Exception e) { |
| | | map.put("id", null); |
| | | map.put("time", null); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isIfViewUUID(String uuid) { |
| | | return uuid.equals(RedisUtil.get("viewId")); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | @Override |
| | | public void insertListData(Integer id, List<LinkDetection> linkDetectionList) { |
| | | for (LinkDetection linkDetection:linkDetectionList){ |
| | | linkDetection.setInspectionStatus(2); |
| | | linkDetection.setInspectionStatus(1); |
| | | linkDetection.setLinkBasicId(id); |
| | | } |
| | | linkDetectionMapper.insertBatchSomeColumn(linkDetectionList); |
| | |
| | | <?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.InspectionProductMapper"> |
| | | |
| | | |
| | | <!--æ ¹æ®æ£éªåidæ¥è¯¢æ£éªé¡¹ç®çæ£éªç»æ--> |
| | | <select id="getresult" resultType="java.lang.Integer"> |
| | | select test_state |
| | |
| | | </select> |
| | | |
| | | <select id="selectLinkAll" resultType="java.util.Map"> |
| | | SELECT DATE_FORMAT(l.`inspection_time`,'%Y-%m-%d') formTime, |
| | | l.`entrusted` supplier, |
| | | d.`sample_number` mcode, |
| | | d.`sample_name` name, |
| | | d.`specifications_models` specifications, |
| | | SELECT DATE_FORMAT(l.`inspection_time`, '%Y-%m-%d') formTime, |
| | | l.`entrusted` supplier, |
| | | d.`sample_number` mcode, |
| | | d.`sample_name` name, |
| | | d.`specifications_models` specifications, |
| | | d.`unit`, |
| | | d.`samples_number` num, |
| | | DATE_FORMAT(date_survey,'%Y-%m-%d') startTime, |
| | | DATE_FORMAT(completion_deadline,'%Y-%m-%d') endTime |
| | | d.`samples_number` num, |
| | | experiment, |
| | | DATE_FORMAT(date_survey, '%Y-%m-%d') startTime, |
| | | DATE_FORMAT(completion_deadline, '%Y-%m-%d') endTime |
| | | FROM lims_laboratory.link_basic_information l, |
| | | lims_laboratory.link_detection d |
| | | WHERE l.`id` = d.`link_basic_id` |
| | | AND l.`state` = 1 |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | package com.yuanchu.limslaboratory.controller; |
| | | |
| | | import com.yuanchu.limslaboratory.pojo.dto.GetAllRoleAndMenuByConditionPageDto; |
| | | import com.yuanchu.limslaboratory.pojo.dto.RoleInfoDto; |
| | | import com.yuanchu.limslaboratory.service.RoleManagerService; |
| | | import com.yuanchu.limslaboratory.vo.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | |
| | | return Result.success(roleManagerService.getMenusTree()); |
| | | }; |
| | | |
| | | @ApiOperation("æ°å¢è§è²") |
| | | @PostMapping("/addRoleInfo") |
| | | public Result<?>addRoleInfo(@RequestBody RoleInfoDto dto){ |
| | | return Result.success(roleManagerService.addRoleInfo(dto)); |
| | | } |
| | | |
| | | @ApiOperation("æ¥è¯¢è§è²åéå¤") |
| | | @GetMapping("/assertRepeat") |
| | | public Result<?> assertRepeat(String roleName){ |
| | | return Result.success(roleManagerService.assertRepeat(roleName)); |
| | | } |
| | | |
| | | @ApiOperation("è·åè§è²ä¿¡æ¯") |
| | | @GetMapping("/getAllRoleAndMenuInfo") |
| | | public Result<?> getAllRoleAndMenuInfo(GetAllRoleAndMenuByConditionPageDto dto){ |
| | | return Result.success(roleManagerService.getAllRoleAndMenuInfo(dto)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.yuanchu.limslaboratory.pojo.LimitPage; |
| | | import com.yuanchu.limslaboratory.pojo.Role; |
| | | import com.yuanchu.limslaboratory.pojo.RoleInfo; |
| | | import com.yuanchu.limslaboratory.pojo.RoleMenu; |
| | | import com.yuanchu.limslaboratory.pojo.dto.GetAllRoleAndMenuByConditionPageDto; |
| | | import com.yuanchu.limslaboratory.pojo.dto.GetPlanMeasureInstrumentDto; |
| | | import com.yuanchu.limslaboratory.pojo.dto.RoleAndMenuDto; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Author å¼ å®¾ |
| | | * @Date 2023/8/24 |
| | | */ |
| | | @Repository |
| | | public interface RoleManageMapper extends BaseMapper<RoleInfo> { |
| | | |
| | | int insertBatchRoleMenu(@Param("roleMenuAddList") List<RoleMenu> roleMenuList); |
| | | |
| | | int insertRole(RoleInfo roleInfo); |
| | | |
| | | List<RoleInfo>getAssertName(@Param("roleName") String roleName); |
| | | |
| | | List<RoleAndMenuDto>selectAllRoleAndMenu(@Param("dto") GetAllRoleAndMenuByConditionPageDto dto); |
| | | |
| | | List<Role>getRoleByName(@Param("roleName") String roleName); |
| | | } |
| | |
| | | /** |
| | | * id |
| | | */ |
| | | private Integer value; |
| | | private Long id; |
| | | |
| | | /** |
| | | * èåå |
| | | */ |
| | | private String label; |
| | | private String name; |
| | | |
| | | |
| | | /** |
| | | * ç¶çº§id |
| | | */ |
| | | private Integer parentId; |
| | | private Long parentId; |
| | | |
| | | /** |
| | | * å级èåä¿¡æ¯ |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * @Author å¼ å®¾ |
| | | * @Date 2023/8/23 |
| | | */ |
| | | @Data |
| | | @TableName("role") |
| | | @Getter |
| | | @Setter |
| | | public class RoleInfo implements Serializable { |
| | | |
| | | |
| | | @TableId(type = IdType.ASSIGN_ID) |
| | | private Long id; |
| | | |
| | | private String name; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss", iso = DateTimeFormat.ISO.DATE_TIME) |
| | | private LocalDateTime createTime; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss", iso = DateTimeFormat.ISO.DATE_TIME) |
| | | private LocalDateTime updateTime; |
| | | |
| | | private Integer state; |
| | | |
| | | public RoleInfo(String name, LocalDateTime createTime, LocalDateTime updateTime) { |
| | | this.name = name; |
| | | this.createTime = createTime; |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public RoleInfo() { |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author å¼ å®¾ |
| | | * @Date 2023/8/24 |
| | | */ |
| | | @Data |
| | | @TableName("role_menu") |
| | | public class RoleMenu implements Serializable { |
| | | |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | private Long roleId; |
| | | |
| | | private String menuName; |
| | | |
| | | private Long menuId; |
| | | |
| | | private Boolean selected; |
| | | |
| | | private Boolean added; |
| | | |
| | | private Long parentId; |
| | | |
| | | private Boolean updated; |
| | | |
| | | private Boolean deleted; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss", iso = DateTimeFormat.ISO.DATE_TIME) |
| | | private LocalDateTime createTime; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss", iso = DateTimeFormat.ISO.DATE_TIME) |
| | | private LocalDateTime updateTime; |
| | | |
| | | private List<RoleMenu> children; |
| | | |
| | | public RoleMenu() { |
| | | } |
| | | |
| | | public RoleMenu(Long id, Long roleId, Long menuId, Boolean selected, Boolean added, Boolean updated, Boolean deleted, LocalDateTime createTime) { |
| | | this.id = id; |
| | | this.roleId = roleId; |
| | | this.menuId = menuId; |
| | | this.selected = selected; |
| | | this.added = added; |
| | | this.updated = updated; |
| | | this.deleted = deleted; |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.pojo.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @Author å¼ å®¾ |
| | | * @Date 2023/8/24 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "GetAllRoleAndMenuByConditionPageDto对象", description = "") |
| | | public class GetAllRoleAndMenuByConditionPageDto implements Serializable { |
| | | @ApiModelProperty(value = "å½å页", example = "1", required = true) |
| | | private Long currentPage; |
| | | @ApiModelProperty(value = "æ¯é¡µå¤å°æ¡", required = true) |
| | | private Long pageSize; |
| | | @ApiModelProperty(value = "è§è²å") |
| | | private String name; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.pojo.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.yuanchu.limslaboratory.pojo.RoleMenu; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author å¼ å®¾ |
| | | * @Date 2023/8/24 |
| | | */ |
| | | @Data |
| | | public class RoleAndMenuDto implements Serializable { |
| | | |
| | | private Long roleId; |
| | | |
| | | private String roleName; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss", iso = DateTimeFormat.ISO.DATE_TIME) |
| | | private LocalDateTime createTime; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss", iso = DateTimeFormat.ISO.DATE_TIME) |
| | | private LocalDateTime updateTime; |
| | | |
| | | private List<RoleMenu> roleMenuList; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.pojo.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Author å¼ å®¾ |
| | | * @Date 2023/8/24 |
| | | */ |
| | | @Data |
| | | public class RoleInfoDto implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "è§è²å", required = true) |
| | | private String roleName; |
| | | |
| | | @ApiModelProperty(value = "éä¸èåä¿¡æ¯") |
| | | private List<Map<String, Object>>menuData; |
| | | } |
| | |
| | | package com.yuanchu.limslaboratory.service; |
| | | |
| | | import com.yuanchu.limslaboratory.vo.Result; |
| | | import com.yuanchu.limslaboratory.pojo.dto.GetAllRoleAndMenuByConditionPageDto; |
| | | import com.yuanchu.limslaboratory.pojo.dto.RoleAndMenuDto; |
| | | import com.yuanchu.limslaboratory.pojo.dto.RoleInfoDto; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Author å¼ å®¾ |
| | |
| | | */ |
| | | public interface RoleManagerService { |
| | | Object getMenusTree(); |
| | | |
| | | boolean addRoleInfo(RoleInfoDto dto); |
| | | |
| | | boolean assertRepeat(String roleName); |
| | | |
| | | Map<String, Object> getAllRoleAndMenuInfo(GetAllRoleAndMenuByConditionPageDto dto); |
| | | } |
| | |
| | | package com.yuanchu.limslaboratory.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.mapper.MenuMapper; |
| | | import com.yuanchu.limslaboratory.mapper.RoleManageMapper; |
| | | import com.yuanchu.limslaboratory.pojo.LimitPage; |
| | | import com.yuanchu.limslaboratory.pojo.Menu; |
| | | import com.yuanchu.limslaboratory.pojo.RoleInfo; |
| | | import com.yuanchu.limslaboratory.pojo.RoleMenu; |
| | | import com.yuanchu.limslaboratory.pojo.dto.GetAllRoleAndMenuByConditionPageDto; |
| | | import com.yuanchu.limslaboratory.pojo.dto.RoleAndMenuDto; |
| | | import com.yuanchu.limslaboratory.pojo.dto.RoleInfoDto; |
| | | import com.yuanchu.limslaboratory.service.RoleManagerService; |
| | | import com.yuanchu.limslaboratory.utils.JsonUtil; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | @Resource |
| | | private MenuMapper menuMapper; |
| | | |
| | | @Resource |
| | | private RoleManageMapper roleManageMapper; |
| | | |
| | | @Override |
| | | public Object getMenusTree() { |
| | | List<Menu> menus = menuMapper.getMenuList(); |
| | |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean addRoleInfo(RoleInfoDto dto) { |
| | | //æ°å¢è§è² |
| | | //System.out.println(dto); |
| | | LocalDateTime createTime = DateUtil.toLocalDateTime(DateUtil.date()); |
| | | RoleInfo role=new RoleInfo(); |
| | | long nextId = IdUtil.getSnowflake().nextId(); |
| | | role.setId(nextId); |
| | | role.setName(dto.getRoleName()); |
| | | role.setCreateTime(createTime); |
| | | int insert = roleManageMapper.insertRole(role); |
| | | List<Map<String, Object>>addBranch=new ArrayList<>(); |
| | | reverseTree(dto.getMenuData(),addBranch); |
| | | List<RoleMenu> roleMenuList =new ArrayList<>(); |
| | | addBranch.forEach(item->{ |
| | | roleMenuList.add(new RoleMenu(null,nextId, |
| | | Long.valueOf(String.valueOf(item.get("id"))) |
| | | ,Boolean.valueOf(String.valueOf(item.get("selected"))) |
| | | ,Boolean.valueOf(String.valueOf(item.get("added"))) |
| | | ,Boolean.valueOf(String.valueOf(item.get("deleted"))) |
| | | ,Boolean.valueOf(String.valueOf(item.get("updated"))) |
| | | ,createTime |
| | | )); |
| | | }); |
| | | //roleMenuAddList.forEach(System.out::println); |
| | | int i = roleManageMapper.insertBatchRoleMenu(roleMenuList); |
| | | return insert>0&&i>0; |
| | | } |
| | | |
| | | @Override |
| | | public boolean assertRepeat(String roleName) { |
| | | List<RoleInfo> assertName = roleManageMapper.getAssertName(roleName); |
| | | return assertName.size()<1; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getAllRoleAndMenuInfo(GetAllRoleAndMenuByConditionPageDto dto) { |
| | | dto.setCurrentPage((dto.getCurrentPage()-1)*dto.getCurrentPage()); |
| | | List<RoleAndMenuDto> roleAndMenuDtos = roleManageMapper.selectAllRoleAndMenu(dto); |
| | | roleAndMenuDtos.forEach(r->{ |
| | | List<RoleMenu>roleMenuList=r.getRoleMenuList(); |
| | | System.out.println(roleMenuList); |
| | | List<RoleMenu> collect = roleMenuList.stream() |
| | | .filter(t -> t.getParentId() == 0) |
| | | .peek((menu) -> menu.setChildren(this.getRoleMenuChildren(menu, roleMenuList))) |
| | | .collect(Collectors.toList()); |
| | | r.setRoleMenuList(collect); |
| | | }); |
| | | roleAndMenuDtos.forEach(r->{ |
| | | r.getRoleMenuList().forEach(System.out::println); |
| | | }); |
| | | Map<String, Object>result=new HashMap<>(3); |
| | | result.put("list",roleAndMenuDtos); |
| | | int size = roleManageMapper.getRoleByName(dto.getName()).size(); |
| | | result.put("total",size); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | private List<Menu> getEnumChildren(Menu root, List<Menu> all) { |
| | | return all.stream() |
| | | .filter(t -> Objects.equals(t.getParentId(), root.getValue())) |
| | | .filter(t -> Objects.equals(t.getParentId(), root.getId())) |
| | | .peek(g -> { |
| | | //æ¾åèå |
| | | g.setChildren(getEnumChildren(g, all)); |
| | |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | private List<RoleMenu> getRoleMenuChildren(RoleMenu root, List<RoleMenu> all) { |
| | | return all.stream() |
| | | .filter(t -> Objects.equals(t.getParentId(), root.getMenuId())) |
| | | .peek(g -> { |
| | | //æ¾åèå |
| | | g.setChildren(getRoleMenuChildren(g, all)); |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | private void reverseTree(List<Map<String, Object>>tree, List<Map<String, Object>>addBranch){ |
| | | tree.forEach(t->{ |
| | | addBranch.add(t); |
| | | if(t.get("children")!=null){ |
| | | List<Map<String, Object>> children = JsonUtil.jsonToPojo( JsonUtil.jsonToString(t.get("children")), List.class); |
| | | addBranch.addAll(children); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | |
| | | <mapper namespace="com.yuanchu.limslaboratory.mapper.MenuMapper"> |
| | | |
| | | <select id="getMenuList" resultType="com.yuanchu.limslaboratory.pojo.Menu"> |
| | | select id value,name label,parent_id parentId |
| | | select id,name,parent_id parentId |
| | | from menu |
| | | where state =1 |
| | | </select> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.RoleManageMapper"> |
| | | <insert id="insertBatchRoleMenu" useGeneratedKeys="true" keyProperty="id"> |
| | | insert |
| | | role_menu (id,`role_id`,`menu_id`,`selected`,`added`,`updated`,`deleted`,`create_time`) |
| | | values |
| | | <foreach collection="roleMenuAddList" separator="," item="r"> |
| | | (#{r.id},#{r.roleId},#{r.menuId},#{r.selected},#{r.added},#{r.updated},#{r.deleted},#{r.createTime}) |
| | | </foreach> |
| | | </insert> |
| | | <insert id="insertRole"> |
| | | insert |
| | | role(id,name,create_time) value ( |
| | | #{id}, |
| | | #{name}, |
| | | #{createTime} |
| | | ) |
| | | </insert> |
| | | <select id="getAssertName" resultType="com.yuanchu.limslaboratory.pojo.RoleInfo"> |
| | | select id |
| | | from role |
| | | where name = #{roleName} |
| | | </select> |
| | | <select id="selectAllRoleAndMenu" resultMap="roleAndMenu"> |
| | | SELECT r.id roleId, |
| | | r.`name` roleName, |
| | | menu_id menuId, |
| | | parent_id parentId, |
| | | m.`name` menuName, |
| | | rm.selected, |
| | | rm.added, |
| | | rm.updated, |
| | | rm.deleted, |
| | | r.create_time createTime, |
| | | r.update_time updateTime |
| | | FROM role_menu rm, |
| | | (select id, name, createTime, updateTime |
| | | from role |
| | | where 1=1 |
| | | <if test="dto.name!=null and dto.name!=''"> |
| | | and name=#{dto.name} |
| | | </if> |
| | | limit #{dto.currentPage}, #{dto.pageSize}) r, |
| | | menu m |
| | | WHERE rm.role_id = r.id |
| | | AND rm.menu_id = m.id |
| | | AND r.state = 1 |
| | | AND rm.state = 1 |
| | | AND m.state = 1 |
| | | </select> |
| | | <select id="getRoleByName" resultType="com.yuanchu.limslaboratory.pojo.Role"> |
| | | select id |
| | | from role |
| | | where 1=1 |
| | | <if test="dto.name!=null and dto.name!=''"> |
| | | and name=#{dto.name} |
| | | </if> |
| | | </select> |
| | | |
| | | <resultMap id="roleAndMenu" type="com.yuanchu.limslaboratory.pojo.dto.RoleAndMenuDto"> |
| | | <result property="roleId" column="roleId"/> |
| | | <result property="roleName" column="roleName"/> |
| | | <result property="createTime" column="createTime"/> |
| | | <result property="updateTime" column="updateTime"/> |
| | | <collection property="roleMenuList" ofType="roleMenu"> |
| | | <result property="menuId" column="menuId"/> |
| | | <result property="added" column="added"/> |
| | | <result property="deleted" column="deleted"/> |
| | | <result property="updated" column="updated"/> |
| | | <result property="selected" column="selected"/> |
| | | <result property="menuName" column="menuName"/> |
| | | <result property="parentId" column="parentId"/> |
| | | </collection> |
| | | </resultMap> |
| | | </mapper> |
| | |
| | | package com.yuanchu.limslaboratory.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.service.ProductService; |
| | | import com.yuanchu.limslaboratory.utils.MyUtil; |
| | | import com.yuanchu.limslaboratory.vo.Result; |
| | | import io.swagger.annotations.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Autowired |
| | | private ProductService productService; |
| | | |
| | | @ApiOperation("æ¥è¯¢è¯¥åå·ä¸ç项ç®") |
| | | @ApiOperation("æ¥è¯¢è¯¥åå·ä¸ç项ç®-->éæ©çæ¬") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "specificationsId", value = "åå·ID", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @GetMapping("/chooseVersion") |
| | | public Result<?> chooseVersion(Integer specificationsId) { |
| | | return Result.success(productService.chooseVersion(specificationsId)); |
| | | } |
| | | |
| | | @ApiOperation("æ¥è¯¢è¯¥åå·ä¸ç项ç®") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "specificationsId", value = "åå·ID", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "version", value = "çæ¬(é»è®¤ææ°çæ¬)", dataTypeClass = Integer.class,required = true ) |
| | | }) |
| | | @GetMapping("/page") |
| | | public Result<?> pageProductInformation(Integer specificationsId) { |
| | | return Result.success(productService.pageProductInformation(specificationsId)); |
| | | public Result<?> pageProductInformation(Integer specificationsId,Integer version) { |
| | | return Result.success(productService.pageProductInformation(specificationsId,version)); |
| | | } |
| | | |
| | | @ApiOperation("å¡«åæ åå¼ä¸å
æ§å¼,é¼ æ ç§»å¼ä¿å") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "id", value = "æ å项ç®ID", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "required", value = "æ åå¼", dataTypeClass = String.class, required = true), |
| | | @ApiImplicitParam(name = "internal", value = "å
æ§å¼", dataTypeClass = String.class, required = true), |
| | | @ApiImplicitParam(name = "internal", value = "å
æ§å¼", dataTypeClass = String.class, required = true) |
| | | |
| | | }) |
| | | @PostMapping("/write") |
| | | public Result<?> write(Integer id, String required, String internal) { |
| | |
| | | productService.deleteList(ids); |
| | | return Result.success("å 餿å"); |
| | | } |
| | | |
| | | @ApiOperation("æ·»å åä¸ä¸ªåå·çå
¶ä»çæ¬") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "specificationsId", value = "åå·id", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @PostMapping("/addVersion") |
| | | public Result<?> addVersion(Integer specificationsId ) { |
| | | Integer version = productService.addVersion(specificationsId); |
| | | return Result.success("æ·»å çæ¬"+version+"æå"); |
| | | } |
| | | } |
| | |
| | | List<Map> selectProductByMaterialId(int materialId); |
| | | |
| | | //å±ç¤ºè¯¥åå·ä¸çæ£éªé¡¹ç®è¦æ± |
| | | List<Map<String, Object>> pageProductInformation(Integer specificationsId); |
| | | List<Map<String, Object>> pageProductInformation(Integer specificationsId,Integer version); |
| | | |
| | | void deleteList(String ids); |
| | | |
| | | //å±ç¤ºè¯¥åå·ä¸çæ£éªé¡¹ç®è¦æ±-->éæ©çæ¬ |
| | | List<Integer> chooseVersion(Integer specificationsId); |
| | | |
| | | //æ¥è¯¢è¯¥åå·ä¸çææè¯éªé¡¹ç®(ç¶ç±») |
| | | List<Map<String,Object>> chooseProject(Integer modelId); |
| | | } |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date updateTime; |
| | | |
| | | @ApiModelProperty(value = "ä¹è§é", hidden = true) |
| | | @ApiModelProperty(value = "çæ¬", hidden = true) |
| | | private Integer version; |
| | | |
| | | @ApiModelProperty(value = "å
³è åå·id", example = "1", hidden = true) |
| | |
| | | package com.yuanchu.limslaboratory.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.pojo.Product; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | |
| | | /** |
| | |
| | | public interface ProductService extends IService<Product> { |
| | | void deleteProductInformation(List<Integer> SpecificationsId); |
| | | |
| | | /** |
| | | * å±ç¤ºè¯¥åå·ä¸çæ£éªé¡¹ç®è¦æ±-->éæ©çæ¬ |
| | | * @param specificationsId |
| | | * @return |
| | | */ |
| | | List<Integer> chooseVersion(Integer specificationsId); |
| | | |
| | | |
| | | /** |
| | | * å±ç¤ºè¯¥åå·ä¸çæ£éªé¡¹ç®è¦æ± |
| | | * @param specificationsId |
| | | * @return |
| | | */ |
| | | List<Map<String,Object>> pageProductInformation(Integer specificationsId); |
| | | List<Map<String,Object>> pageProductInformation(Integer specificationsId,Integer version); |
| | | |
| | | /** |
| | | * å¡«åæ åå¼ä¸å
æ§å¼,é¼ æ ç§»å¼ä¿å |
| | |
| | | Integer write(Integer id, String required, String internal); |
| | | |
| | | void deleteList(String ids); |
| | | |
| | | /** |
| | | * æ·»å åä¸ä¸ªåå·çå
¶ä»çæ¬ |
| | | * @param specificationsId |
| | | * @return |
| | | */ |
| | | Integer addVersion(Integer specificationsId); |
| | | |
| | | |
| | | /** |
| | | * æ¥è¯¢è¯¥åå·ä¸çææè¯éªé¡¹ç®(ç¶ç±») |
| | | * @param modelId |
| | | * @return |
| | | */ |
| | | List<Map<String,Object>> chooseProject(Integer modelId); |
| | | } |
| | |
| | | package com.yuanchu.limslaboratory.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.mapper.ProductModelMapper; |
| | | import com.yuanchu.limslaboratory.mapper.SpecificationsMapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.yuanchu.limslaboratory.pojo.Product; |
| | | import com.yuanchu.limslaboratory.mapper.ProductMapper; |
| | | import com.yuanchu.limslaboratory.pojo.ProductModel; |
| | | import com.yuanchu.limslaboratory.service.ProductService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.limslaboratory.utils.MyUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.yuanchu.limslaboratory.service.UserService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Resource |
| | | private ProductMapper productMapper; |
| | | |
| | | @Resource |
| | | ProductModelMapper productModelMapper; |
| | | |
| | | |
| | | @Override |
| | | public void deleteProductInformation(List<Integer> SpecificationsId) { |
| | |
| | | } |
| | | } |
| | | |
| | | //å±ç¤ºè¯¥åå·ä¸çæ£éªé¡¹ç®è¦æ±-->éæ©çæ¬ |
| | | @Override |
| | | public List<Integer> chooseVersion(Integer specificationsId) { |
| | | return productMapper.chooseVersion(specificationsId); |
| | | } |
| | | |
| | | //å±ç¤ºè¯¥åå·ä¸çæ£éªé¡¹ç®è¦æ± |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public List<Map<String, Object>> pageProductInformation(Integer specificationsId) { |
| | | return productMapper.pageProductInformation(specificationsId); |
| | | public List<Map<String, Object>> pageProductInformation(Integer specificationsId,Integer version) { |
| | | return productMapper.pageProductInformation(specificationsId,version); |
| | | } |
| | | |
| | | //å¡«åæ åå¼ä¸å
æ§å¼,é¼ æ ç§»å¼ä¿å |
| | |
| | | productMapper.deleteList(ids); |
| | | } |
| | | |
| | | //æ·»å åä¸ä¸ªåå·çå
¶ä»çæ¬ |
| | | @Override |
| | | public Integer addVersion(Integer specificationsId) { |
| | | List<Product> productList = productMapper.selectList(Wrappers.<Product>query().eq("specifications_id", specificationsId)); |
| | | for (Product product : productList) { |
| | | product.setVersion(product.getVersion()+1); |
| | | } |
| | | saveBatch(productList); |
| | | return productList.get(0).getVersion(); |
| | | } |
| | | |
| | | //æ¥è¯¢è¯¥åå·ä¸çææè¯éªé¡¹ç®(ç¶ç±») |
| | | @Override |
| | | public List<Map<String,Object>> chooseProject(Integer modelId) { |
| | | return productMapper.chooseProject(modelId); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | <result property="unit" column="unit"/> |
| | | <result property="required" column="required"/> |
| | | <result property="internal" column="internal"/> |
| | | <result property="version" column="version"/> |
| | | </resultMap> |
| | | |
| | | <select id="pageProductInformation" resultMap="pageProductInformationMap"> |
| | |
| | | father, |
| | | unit, |
| | | required, |
| | | internal |
| | | internal, |
| | | version |
| | | from lims_laboratory.product |
| | | where state = 1 |
| | | and specifications_id = #{specificationsId} |
| | | ORDER BY product.`create_time` DESC |
| | | and version = #{version} |
| | | </select> |
| | | |
| | | <select id="deleteList"> |
| | |
| | | set state=0 |
| | | where id in (${ids}) |
| | | </select> |
| | | |
| | | <!--å±ç¤ºè¯¥åå·ä¸çæ£éªé¡¹ç®è¦æ±-éæ©çæ¬--> |
| | | <select id="chooseVersion" resultType="java.lang.Integer"> |
| | | select distinct version |
| | | from lims_laboratory.product |
| | | where state = 1 |
| | | and specifications_id = #{specificationsId} |
| | | order by version desc |
| | | </select> |
| | | |
| | | <!--æ¥è¯¢è¯¥åå·ä¸çææè¯éªé¡¹ç®(ç¶ç±»)--> |
| | | <resultMap id="chooseProjects" type="map"> |
| | | <id property="name" column="father"/> |
| | | <collection property="children" resultMap="chooseProjectTowMap" javaType="List"/> |
| | | </resultMap> |
| | | <resultMap id="chooseProjectTowMap" type="map"> |
| | | <id property="id" column="id"/> |
| | | <result property="name" column="name"/> |
| | | </resultMap> |
| | | <select id="chooseProject" resultMap="chooseProjects"> |
| | | select id, father, name |
| | | from lims_laboratory.product |
| | | where state = 1 |
| | | and specifications_id = #{modelId} |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | 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.web.bind.annotation.*; |
| | | import com.yuanchu.limslaboratory.service.WaitInformationService; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | | * æçå¾
å表(WaitInformation)表æ§å¶å± |
| | | * |
| | | * @author zss |
| | | * @since 2023-08-24 10:00:21 |
| | | */ |
| | | @Api(tags = "æ¶æ¯å¾
å-->æçå¾
å") |
| | | @RestController |
| | | @RequestMapping("/waitInformation") |
| | | public class WaitInformationController { |
| | | |
| | | @Autowired |
| | | private WaitInformationService waitInformationService; |
| | | |
| | | @ApiOperation(value = "æ¥è¯¢å¾
å表å表") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "pageSize", value = "页æ°", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "countSize", value = "æ¡æ°/页", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "title", value = "æ é¢", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "text", value = "å
容", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "type", value = "ç¶æ(为空=å
¨é¨)", dataTypeClass = Integer.class) |
| | | }) |
| | | @GetMapping("/selectWaitInforList") |
| | | public Result selectWaitInforList(@RequestHeader("token") String token,int pageSize, int countSize, String title, String text, Integer type) throws Exception { |
| | | Object object = RedisUtil.get(token); |
| | | Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(object), Map.class); |
| | | IPage<Map<String, Object>> waitInformationPage = waitInformationService.selectWaitInforList(new Page<Object>(pageSize, countSize),unmarshal.get("name").toString(), title, text, type); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("total", waitInformationPage.getTotal()); |
| | | map.put("row", waitInformationPage.getRecords()); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ¹éå é¤") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "ids", value = "å¾
åid", dataTypeClass = String.class,required = true) |
| | | }) |
| | | @GetMapping("/delAllWaitInfor") |
| | | public Result delAllWaitInfor(@RequestHeader("token") String token,String ids) throws Exception { |
| | | Object object = RedisUtil.get(token); |
| | | Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(object), Map.class); |
| | | waitInformationService.delAllWaitInfor(unmarshal.get("name").toString(),ids); |
| | | return Result.success("å 餿å!"); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ¹éæ 为已读") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "ids", value = "å¾
åid", dataTypeClass = String.class,required = true) |
| | | }) |
| | | @GetMapping("/writeAllWaitInfor") |
| | | public Result writeAllWaitInfor(@RequestHeader("token") String token,String ids) throws Exception { |
| | | Object object = RedisUtil.get(token); |
| | | Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(object), Map.class); |
| | | waitInformationService.writeAllWaitInfor(unmarshal.get("name").toString(),ids); |
| | | return Result.success("已读æå"); |
| | | } |
| | | |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.pojo.WaitInformation; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æçå¾
å表(WaitInformation)è¡¨æ°æ®åºè®¿é®å± |
| | | * |
| | | * @author zss |
| | | * @since 2023-08-24 10:00:21 |
| | | */ |
| | | public interface WaitInformationMapper extends BaseMapper<WaitInformation> { |
| | | |
| | | //æ¥è¯¢å¾
å表å表 |
| | | IPage<Map<String, Object>> selectWaitInforList(Page<Object> page,String rename, String title, String text,Integer type); |
| | | |
| | | //æ¹éå é¤ |
| | | void delAllWaitInfor(String rename,String ids); |
| | | |
| | | //æ¹é已读 |
| | | void writeAllWaitInfor(String rename,String ids); |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.*; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * æçå¾
å表(WaitInformation)表å®ä½ç±» |
| | | * |
| | | * @author zss |
| | | * @since 2023-08-24 10:00:22 |
| | | */ |
| | | @Data |
| | | @Accessors(chain = true) |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Builder |
| | | @TableName("wait_information") |
| | | public class WaitInformation implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * id |
| | | **/ |
| | | @TableId(type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * å件人 |
| | | **/ |
| | | private String name; |
| | | |
| | | /** |
| | | * å件人 |
| | | **/ |
| | | private String rename; |
| | | |
| | | /** |
| | | * æ é¢ |
| | | **/ |
| | | private String title; |
| | | |
| | | /** |
| | | * å¾
åå
容 |
| | | **/ |
| | | private String text; |
| | | |
| | | /** |
| | | * ç¶æ 0:æªè¯»;1:已读 |
| | | **/ |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "é»è¾å é¤ æ£å¸¸>=1,å é¤<=0", hidden = true) |
| | | private Integer state; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private Date createTime; |
| | | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private Date updateTime; |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.yuanchu.limslaboratory.pojo.WaitInformation; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æçå¾
å表(WaitInformation)表æå¡æ¥å£ |
| | | * |
| | | * @author zss |
| | | * @since 2023-08-24 10:00:22 |
| | | */ |
| | | public interface WaitInformationService extends IService<WaitInformation> { |
| | | |
| | | |
| | | /** |
| | | * æ·»å å¾
å |
| | | * @param name |
| | | * @param title |
| | | * @param text |
| | | */ |
| | | //todo:æ·»å å¾
åæ¶æ¯ |
| | | void addWaitInfor(String name,String title,String text,String rename); |
| | | |
| | | |
| | | /** |
| | | * æ¥è¯¢å¾
å表å表 |
| | | * @param page |
| | | * @param title |
| | | * @param text |
| | | * @return |
| | | */ |
| | | IPage<Map<String, Object>> selectWaitInforList(Page<Object> page,String rename, String title, String text,Integer type); |
| | | |
| | | /** |
| | | * æ¹éå é¤ |
| | | * @param ids |
| | | */ |
| | | void delAllWaitInfor(String rename,String ids); |
| | | |
| | | |
| | | /** |
| | | * æ¹é已读 |
| | | * @param ids |
| | | */ |
| | | void writeAllWaitInfor(String rename,String ids); |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.limslaboratory.mapper.WaitInformationMapper; |
| | | import com.yuanchu.limslaboratory.pojo.WaitInformation; |
| | | import com.yuanchu.limslaboratory.service.WaitInformationService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æçå¾
å表(WaitInformation)表æå¡å®ç°ç±» |
| | | * |
| | | * @author zss |
| | | * @since 2023-08-24 10:00:22 |
| | | */ |
| | | @Service |
| | | public class WaitInformationServiceImpl extends ServiceImpl<WaitInformationMapper, WaitInformation> implements WaitInformationService { |
| | | |
| | | @Resource |
| | | WaitInformationMapper waitInformationMapper; |
| | | |
| | | |
| | | //æ·»å å¾
å |
| | | @Override |
| | | public void addWaitInfor(String name, String title, String text, String rename) { |
| | | WaitInformation waitInformation = WaitInformation.builder() |
| | | .name(name) |
| | | .title(title) |
| | | .text(text) |
| | | .rename(rename) |
| | | .build(); |
| | | waitInformationMapper.insert(waitInformation); |
| | | } |
| | | |
| | | //æ¥è¯¢å¾
å表å表 |
| | | @Override |
| | | public IPage<Map<String, Object>> selectWaitInforList(Page<Object> page, String rename, String title, String text, Integer type) { |
| | | return waitInformationMapper.selectWaitInforList(page, rename, title, text, type); |
| | | } |
| | | |
| | | //æ¹éå é¤ |
| | | @Override |
| | | public void delAllWaitInfor(String rename, String ids) { |
| | | waitInformationMapper.delAllWaitInfor(rename, ids); |
| | | } |
| | | |
| | | //æ¹é已读 |
| | | @Override |
| | | public void writeAllWaitInfor(String rename, String ids) { |
| | | waitInformationMapper.writeAllWaitInfor(rename, ids); |
| | | } |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.WaitInformationMapper"> |
| | | <!--æ¥è¯¢å¾
å表å表--> |
| | | <select id="selectWaitInforList" resultType="java.util.Map"> |
| | | select id, |
| | | name, |
| | | title, |
| | | text, |
| | | DATE_FORMAT(create_time,'%Y-%m-%d') creatTime, |
| | | type |
| | | from lims_laboratory.wait_information |
| | | where state=1 |
| | | and `rename`=#{rename} |
| | | <if test="title!=null and title!=''"> |
| | | and title like concat('%',#{title},'%') |
| | | </if> |
| | | <if test="text!=null and text!=''"> |
| | | and text like concat('%',#{text},'%') |
| | | </if> |
| | | <if test="type!=null "> |
| | | and type =#{type} |
| | | </if> |
| | | </select> |
| | | |
| | | <!--æ¹éå é¤--> |
| | | <update id="delAllWaitInfor"> |
| | | update lims_laboratory.wait_information |
| | | set state=0 |
| | | where `rename`=#{rename} |
| | | and id in (${ids}) |
| | | </update> |
| | | |
| | | <!--æ¹é已读--> |
| | | <update id="writeAllWaitInfor"> |
| | | update lims_laboratory.wait_information |
| | | set type=1 |
| | | where wait_information.state = 1 |
| | | and `rename`=#{rename} |
| | | and id in (${ids}) |
| | | </update> |
| | | </mapper> |