LIMS管理系统框架-开发7-27第二次标准库完成修改
| | |
| | | import org.springframework.http.converter.HttpMessageNotReadableException; |
| | | import org.springframework.http.converter.HttpMessageNotWritableException; |
| | | import org.springframework.jdbc.BadSqlGrammarException; |
| | | import org.springframework.validation.ObjectError; |
| | | import org.springframework.web.bind.MethodArgumentNotValidException; |
| | | import org.springframework.web.bind.annotation.ExceptionHandler; |
| | | import org.springframework.web.bind.annotation.RestControllerAdvice; |
| | | import org.springframework.web.multipart.MultipartException; |
| | | |
| | | import java.io.FileNotFoundException; |
| | | import java.io.IOException; |
| | | import java.net.BindException; |
| | | import java.sql.SQLException; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | @Slf4j |
| | |
| | | return Result.fail("æ±æä¸æ¯æã" + e.getMessage() +"ãåç¼çæä»¶ï¼"); |
| | | } |
| | | |
| | | /** |
| | | * åæ°æ£éª |
| | | */ |
| | | @ExceptionHandler({MethodArgumentNotValidException.class}) |
| | | public Result<?> methodArgumentNotValidException(MethodArgumentNotValidException e) { |
| | | List<ObjectError> allErrors = e.getBindingResult().getAllErrors(); |
| | | String message = allErrors.stream().map(s -> s.getDefaultMessage()).collect(Collectors.joining(";")); |
| | | return Result.fail(message); |
| | | } |
| | | |
| | | /** å
¶ä»é误 */ |
| | | @ExceptionHandler({Exception.class}) |
| | | public Result<?> exception(Exception e) { |
| | |
| | | import com.yuanchu.limslaboratory.pojo.Product; |
| | | import com.yuanchu.limslaboratory.service.*; |
| | | import com.yuanchu.limslaboratory.utils.JackSonUtil; |
| | | import com.yuanchu.limslaboratory.utils.MyUtil; |
| | | import com.yuanchu.limslaboratory.utils.RedisUtil; |
| | | import com.yuanchu.limslaboratory.vo.Result; |
| | | import io.swagger.annotations.*; |
| | |
| | | @ApiOperation("æ¥è¯¢ç©æä¿¡æ¯") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "pageSize", value = "页æ°", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "countSize", value = "æ¡æ°/页", dataTypeClass = Integer.class, required = true) |
| | | @ApiImplicitParam(name = "countSize", value = "æ¡æ°/页", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "type", value = "ç±»å", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @GetMapping("/selectMaterialLimit") |
| | | public Result selectMaterialLimit(int pageSize, int countSize) { |
| | | return Result.success(materialService.selectMaterialLimit(pageSize, countSize)); |
| | | public Result selectMaterialLimit(int pageSize, int countSize, int type) { |
| | | return Result.success(materialService.selectMaterialLimit(pageSize, countSize, type)); |
| | | } |
| | | |
| | | @ApiOperation("éæ©ç©æä¿¡æ¯") |
| | |
| | | package com.yuanchu.limslaboratory.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.yuanchu.limslaboratory.pojo.InspectionMaterialList; |
| | | import com.yuanchu.limslaboratory.service.InspectionMaterialListService; |
| | | import com.yuanchu.limslaboratory.utils.JackSonUtil; |
| | |
| | | |
| | | @ApiOperation("æ ¹æ®Idæ¥è¯¢æ ·åä¿¡æ¯") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "inspectionMaterialListId", value = "æ ·åID", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "inspectionId", value = "æ ·åID", dataTypeClass = String.class, required = true), |
| | | }) |
| | | @PutMapping("/selectInspectionMaterialListById/{inspectionMaterialListId}") |
| | | public Result selectInspectionMaterialListById(@PathVariable Integer inspectionMaterialListId) { |
| | | return Result.success(inspectionMaterialListService.getById(inspectionMaterialListId)); |
| | | @GetMapping("/selectInspectionMaterialListById/{inspectionId}") |
| | | public Result selectInspectionMaterialListById(@PathVariable String inspectionId) { |
| | | return Result.success(inspectionMaterialListService.list(new QueryWrapper<InspectionMaterialList>().eq("inspection_id", inspectionId).eq("state", 1))); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®æ ·åidä¿®æ¹æ ·åä¿¡æ¯") |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | return Result.fail("æ·»å ã"+ equipmentPoint.getEquipmentPointName() +"ã失败ï¼è®¾å¤ç ç¹ç¼ç éå¤ï¼"); |
| | | } |
| | | |
| | | @ApiOperation("æ¥è¯¢ææè®¾å¤ç ç¹æ°æ®") |
| | | @ApiOperation("æ ¹æ®ä»ªå¨Idæ¥è¯¢å¯¹åºè®¾å¤ç ç¹æ°æ®") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "InstrumentId", value = "ä»ªå¨æ¨¡åId", dataTypeClass = String.class, required = true) |
| | | }) |
| | | @GetMapping("/list") |
| | | public Result<?> getListEquipmentPointInformation() { |
| | | List<Map<String, Object>> list = equipmentPointService.getListEquipmentPointInformation(); |
| | | public Result<?> getListEquipmentPointInformation(String InstrumentId) { |
| | | List<Map<String, Object>> list = equipmentPointService.getListEquipmentPointInformation(InstrumentId); |
| | | return Result.success(list); |
| | | } |
| | | |
| | |
| | | package com.yuanchu.limslaboratory.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.pojo.Instrument; |
| | | import com.yuanchu.limslaboratory.pojo.dto.UpdateInstrumentDto; |
| | | import com.yuanchu.limslaboratory.service.InstrumentService; |
| | | import com.yuanchu.limslaboratory.service.UserService; |
| | | 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 org.springframework.web.bind.annotation.RestController; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-07-20 |
| | | */ |
| | | @Api(tags = "å®éªå®¤-->设å¤å°è´¦-->2ãä»ªå¨æ¨¡å") |
| | | @RestController |
| | | @RequestMapping("/instrument") |
| | | public class InstrumentController { |
| | | |
| | | @Autowired |
| | | private InstrumentService instrumentService; |
| | | |
| | | @Autowired |
| | | private UserService userService; |
| | | |
| | | @ApiOperation("æ·»å 仪å¨è®¾å¤") |
| | | @PostMapping("/add") |
| | | public Result<?> addInstrumentInformation(@RequestHeader("X-Token") String token, @RequestBody Instrument instrument) throws Exception { |
| | | Object object = RedisUtil.get(token); |
| | | Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(object), Map.class); |
| | | instrument.setCreateUserId((Integer) unmarshal.get("id")); |
| | | Integer isInsertSuccess = instrumentService.addInstrumentInformation(instrument); |
| | | if (isInsertSuccess == 1){ |
| | | return Result.success("æ·»å ã" + instrument.getEquipmentName() + "ãæå!"); |
| | | } |
| | | return Result.fail("仪å¨è®¾å¤ç¼å·éå¤ï¼æ·»å ã" + instrument.getEquipmentName() + "ã失败! "); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®åç±»Idï¼å页å表å±ç¤º") |
| | | @GetMapping("/list") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "classifyId", value = "åç±»Id", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "pageNo", value = "èµ·å§é¡µ", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "pageSize", value = "æ¯ä¸é¡µæ°é", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "conditions", value = "æ¥è¯¢ç¶æ:é»è®¤å
¨é¨", dataTypeClass = Integer.class), |
| | | @ApiImplicitParam(name = "whetherWhether", value = "æ¯å¦å·²è¿æ", dataTypeClass = Boolean.class), |
| | | @ApiImplicitParam(name = "numberOrNameOrSpecifications", value = "ç¼å·/设å¤åç§°/è§æ ¼åå·", dataTypeClass = String.class) |
| | | }) |
| | | public Result<?> getListInstrumentInformation(Integer pageNo, |
| | | Integer pageSize, |
| | | Integer conditions, |
| | | Integer classifyId, |
| | | Boolean whetherWhether, |
| | | String numberOrNameOrSpecifications) { |
| | | IPage<Map<String, Object>> pageList = instrumentService.getListInstrumentInformation(conditions, whetherWhether, numberOrNameOrSpecifications, |
| | | classifyId, new Page<Objects>(pageNo, pageSize)); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("row", pageList.getRecords()); |
| | | map.put("total", pageList.getTotal()); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | @ApiOperation("å é¤ä»ªå¨æ°æ®") |
| | | @DeleteMapping("/delete") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "instrumentId", value = "仪å¨Id", dataTypeClass = String.class, required = true) |
| | | }) |
| | | public Result<?> deleteInstrumentInformation(String instrumentId) { |
| | | Boolean isDeleteSuccess = instrumentService.deleteInstrumentInformation(instrumentId); |
| | | if (isDeleteSuccess){ |
| | | return Result.success("å é¤ä»ªå¨æåï¼"); |
| | | } |
| | | return Result.fail("å é¤ä»ªå¨å¤±è´¥ï¼"); |
| | | } |
| | | |
| | | @ApiOperation("æ·»å ä»ªå¨æ¶ä¿ç®¡äººä¸ææ¡æ°æ®") |
| | | @GetMapping("/get_user") |
| | | public Result<?> getMapUserInformation() { |
| | | return Result.success(userService.getUserNameAndId()); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®ä»ªå¨Idè·åä¿¡æ¯ç¨äºç¼è¾") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "InstrumentId", value = "åç±»Id", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @GetMapping("/get_instrument") |
| | | public Result<?> getIdInstrumentInformation(Integer InstrumentId) { |
| | | Instrument idInstrumentInformation = instrumentService.getIdInstrumentInformation(InstrumentId); |
| | | return Result.success(idInstrumentInformation); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®ä»ªå¨Idæ´æ°æ°æ®") |
| | | @PutMapping("/update") |
| | | public Result<?> updateEquipmentPointInformation(@RequestBody UpdateInstrumentDto updateInstrumentDto) throws Exception { |
| | | Instrument instrument = JackSonUtil.unmarshal(JackSonUtil.marshal(updateInstrumentDto), Instrument.class); |
| | | Integer isUpdateSuccess = instrumentService.updateEquipmentPointInformation(instrument); |
| | | if (isUpdateSuccess == 1){ |
| | | return Result.success("æ´æ°ã" + instrument.getEquipmentName() + "ãæå!"); |
| | | } |
| | | return Result.fail("仪å¨è®¾å¤ç¼å·éå¤ï¼æ´æ°ã" + instrument.getEquipmentName() + "ã失败! "); |
| | | } |
| | | } |
| | |
| | | package com.yuanchu.limslaboratory.controller; |
| | | |
| | | import com.yuanchu.limslaboratory.pojo.MetricalInformation; |
| | | import com.yuanchu.limslaboratory.pojo.dto.UpdateMetricalInformationDto; |
| | | import com.yuanchu.limslaboratory.service.MetricalInformationService; |
| | | import com.yuanchu.limslaboratory.service.UserService; |
| | | import com.yuanchu.limslaboratory.utils.JackSonUtil; |
| | | 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 org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-07-20 |
| | | */ |
| | | @Api(tags = "å®éªå®¤-->设å¤å°è´¦-->4ã计éä¿¡æ¯") |
| | | @RestController |
| | | @RequestMapping("/metrical-information") |
| | | public class MetricalInformationController { |
| | | |
| | | @Autowired |
| | | private MetricalInformationService metricalInformationService; |
| | | |
| | | @Autowired |
| | | private UserService userService; |
| | | |
| | | @ApiOperation("æ·»å 计éä¿¡æ¯") |
| | | @PostMapping("/add") |
| | | public Result<?> addMetricalInformation(MetricalInformation metricalInformation, |
| | | @RequestPart(value = "file", required = false) MultipartFile file) { |
| | | Integer isInsertSuccess = metricalInformationService.addEquipmentPointInformation(metricalInformation, file); |
| | | if (isInsertSuccess == 1){ |
| | | return Result.success("æ·»å ã"+ metricalInformation.getMeasurementUnit() +"ãæåï¼"); |
| | | } |
| | | return Result.fail("æ·»å ã"+ metricalInformation.getMeasurementUnit() +"ã失败ï¼è®¾å¤ç ç¹ç¼ç éå¤ï¼"); |
| | | } |
| | | |
| | | @ApiOperation("æ¥è¯¢ææè®¡éä¿¡æ¯æ°æ®") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "InstrumentId", value = "ä»ªå¨æ¨¡åId", dataTypeClass = String.class, required = true) |
| | | }) |
| | | @GetMapping("/list") |
| | | public Result<?> getListMetricalInformation(String InstrumentId) { |
| | | List<Map<String, Object>> list = metricalInformationService.getListEquipmentPointInformation(InstrumentId); |
| | | return Result.success(list); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®è®¡éä¿¡æ¯Idå 餿°æ®") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "metricalInformationId", value = "计éä¿¡æ¯Id", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @DeleteMapping("/delete") |
| | | public Result<?> deleteMetricalInformation(Integer metricalInformationId) { |
| | | Integer isDeleteSuccess = metricalInformationService.deleteMetricalInformation(metricalInformationId); |
| | | if (isDeleteSuccess == 1){ |
| | | return Result.success("å 餿åï¼"); |
| | | } |
| | | return Result.fail("å é¤å¤±è´¥ï¼"); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®è®¡éä¿¡æ¯Idæ´æ°æ°æ®") |
| | | @PutMapping("/update") |
| | | public Result<?> updateMetricalInformation(UpdateMetricalInformationDto updateMetricalInformationDto, |
| | | @RequestPart(value = "file", required = false) MultipartFile file) throws Exception { |
| | | MetricalInformation metricalInformation = JackSonUtil.unmarshal(JackSonUtil.marshal(updateMetricalInformationDto), MetricalInformation.class); |
| | | Integer isUpdateSuccess = metricalInformationService.updateMetricalInformation(metricalInformation, file); |
| | | if (isUpdateSuccess == 1){ |
| | | return Result.success("æ´æ°æåï¼"); |
| | | } |
| | | return Result.fail("æ´æ°å¤±è´¥ï¼"); |
| | | } |
| | | |
| | | @ApiOperation("æ·»å 计éä¿¡æ¯æ¶è´è´£äººä¸ææ¡æ°æ®") |
| | | @GetMapping("/get_user") |
| | | public Result<?> getMapUserInformation() { |
| | | return Result.success(userService.getUserNameAndId()); |
| | | } |
| | | } |
| | |
| | | */ |
| | | public interface EquipmentPointMapper extends BaseMapper<EquipmentPoint> { |
| | | |
| | | List<Map<String, Object>> getListEquipmentPointInformation(); |
| | | List<Map<String, Object>> getListEquipmentPointInformation(String InstrumentId); |
| | | } |
| | |
| | | */ |
| | | public interface MetricalInformationMapper extends BaseMapper<MetricalInformation> { |
| | | |
| | | List<Map<String, Object>> getListEquipmentPointInformation(); |
| | | List<Map<String, Object>> getListEquipmentPointInformation(String InstrumentId); |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @ApiModelProperty(value = "ä¿ç®¡äººï¼ç¨æ·è¡¨å
³èId", example = "9", required = true) |
| | | private Integer userId; |
| | | |
| | | @ApiModelProperty(value = "ä¿ç®¡äººï¼ç¨æ·è¡¨å
³èId", hidden = true) |
| | | private Integer createUserId; |
| | | |
| | | @ApiModelProperty(value = "仪å¨è®¾å¤ç¼å·", example = "JSTC-W1-00001", required = true) |
| | | private String equipmentCode; |
| | | |
| | |
| | | |
| | | @ApiModelProperty(value = "å°è´§æ¥æ", example = "2001-07-06", dataType = "date") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date arrivalDate; |
| | | |
| | | @ApiModelProperty(value = "éªæ¶æ¥æ", example = "2060-07-06", dataType = "date") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date acceptanceDate; |
| | | |
| | | @ApiModelProperty(value = "åæ¾å°", example = "å°çäºæ´²ä¸å½æ±èåé") |
| | |
| | | @ApiModelProperty(value = "é»è¾å é¤ æ£å¸¸>=1,å é¤<=0", hidden = true) |
| | | private Integer state; |
| | | |
| | | @JsonIgnore |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @ApiModelProperty(value = "å建æ¶é´", hidden = true) |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private Date createTime; |
| | | |
| | | @JsonIgnore |
| | |
| | | @ApiModelProperty(value = "ç¨æ·å
³èId", example = "7", required = true) |
| | | private Integer userId; |
| | | |
| | | @ApiModelProperty(value = "仪å¨å
³èId", example = "1", required = true) |
| | | private Integer instrumentId; |
| | | |
| | | @ApiModelProperty(value = "计éåä½", example = "GB", required = true) |
| | | private String measurementUnit; |
| | | |
| | |
| | | |
| | | Integer addEquipmentPointInformation(EquipmentPoint equipmentPoint); |
| | | |
| | | List<Map<String, Object>> getListEquipmentPointInformation(); |
| | | List<Map<String, Object>> getListEquipmentPointInformation(String InstrumentId); |
| | | |
| | | Integer deleteEquipmentPointInformation(Integer equipmentPointId); |
| | | |
| | |
| | | |
| | | Integer addEquipmentPointInformation(MetricalInformation metricalInformation, MultipartFile file); |
| | | |
| | | List<Map<String, Object>> getListEquipmentPointInformation(); |
| | | List<Map<String, Object>> getListEquipmentPointInformation(String InstrumentId); |
| | | |
| | | Integer deleteMetricalInformation(Integer metricalInformationId); |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getListEquipmentPointInformation() { |
| | | return equipmentPointMapper.getListEquipmentPointInformation(); |
| | | public List<Map<String, Object>> getListEquipmentPointInformation(String InstrumentId) { |
| | | return equipmentPointMapper.getListEquipmentPointInformation(InstrumentId); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getListEquipmentPointInformation() { |
| | | return metricalInformationMapper.getListEquipmentPointInformation(); |
| | | public List<Map<String, Object>> getListEquipmentPointInformation(String InstrumentId) { |
| | | return metricalInformationMapper.getListEquipmentPointInformation(InstrumentId); |
| | | } |
| | | |
| | | @Override |
| | |
| | | SELECT e.`id`, e.`equipment_point` equipmentPoint, e.`equipment_point_name` equipmentPointName, e.`unit`,u.`name`, DATE_FORMAT(e.`update_time`, '%Y-%m-%d') updateTime, e.`descriptiveness` |
| | | FROM equipment_point e, `user` u |
| | | WHERE e.`user_id` = u.`id` |
| | | AND e.`instrument_id` = #{InstrumentId} |
| | | </select> |
| | | </mapper> |
| | |
| | | FROM metrical_information m, `user` u |
| | | WHERE m.`user_id` = u.`id` |
| | | AND m.`state` = 1 |
| | | AND m.`instrument_id` = #{InstrumentId} |
| | | </select> |
| | | </mapper> |
| | |
| | | <artifactId>mybatis-plus-boot-starter</artifactId> |
| | | <version>${mybatis-plus.version}</version> |
| | | </dependency> |
| | | |
| | | <!--åç«¯æ³¨éæ£éªå·¥å
·--> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-validation</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | <dependencyManagement> |
| | | <dependencies> |
| | |
| | | package com.yuanchu.limslaboratory.controller; |
| | | |
| | | |
| | | import com.yuanchu.limslaboratory.pojo.Material; |
| | | import com.yuanchu.limslaboratory.pojo.dto.AddMaterialDto; |
| | | import com.yuanchu.limslaboratory.service.MaterialService; |
| | | import com.yuanchu.limslaboratory.vo.Result; |
| | | import io.swagger.annotations.Api; |
| | |
| | | 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 java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | @ApiOperation("æ·»å ç©æ") |
| | | @PostMapping("/add") |
| | | public Result<?> addMaterialInformation(@RequestBody Material material) { |
| | | Integer isMaterialSuccess = null; |
| | | public Result<?> addMaterialInformation(@Validated @RequestBody AddMaterialDto addMaterialDto) { |
| | | Integer isMaterialSuccess = materialService.addMaterialInformation(addMaterialDto); |
| | | if (isMaterialSuccess == 1) { |
| | | return Result.success("æ·»å ç©æã"+ material.getName() +"ãæåï¼"); |
| | | return Result.success("æ·»å ç©æã"+ addMaterialDto.getMaterialName() +"ãæåï¼"); |
| | | } |
| | | return Result.fail("æ·»å ç©æã"+ material.getName() +"ã失败ï¼"); |
| | | return Result.fail("æ·»å ç©æã"+ addMaterialDto.getMaterialName() +"ã失败ï¼"); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®ç©æIDå é¤ç©æ") |
| | | @DeleteMapping("/delete") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(value = "ç©æID", name = "materialId", dataTypeClass = String.class) |
| | | @ApiImplicitParam(value = "ç©æID", name = "materialId", dataTypeClass = Integer.class) |
| | | }) |
| | | public Result<?> deleteMaterialInformation(String materialId) { |
| | | public Result<?> deleteMaterialInformation(Integer materialId) { |
| | | Integer isDeleteMaterialSuccess = materialService.deleteMaterialInformation(materialId); |
| | | if (isDeleteMaterialSuccess == 1) { |
| | | return Result.success("å 餿åï¼"); |
| | | } |
| | | return Result.fail("å é¤å¤±è´¥ï¼"); |
| | | } |
| | | |
| | | @ApiOperation("ä¾§è¾¹æ å级å±å¼") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(value = "åå·/åå·åç§°", name = "specificationName", dataTypeClass = String.class) |
| | | }) |
| | | @GetMapping("/list") |
| | | public Result<?> getFourLevelInformation(String specificationName) { |
| | | List<Map<String, Object>> fourLevelInformation = materialService.getFourLevelInformation(specificationName); |
| | | return Result.success(fourLevelInformation); |
| | | } |
| | | } |
| | |
| | | package com.yuanchu.limslaboratory.controller; |
| | | |
| | | import com.yuanchu.limslaboratory.pojo.Product; |
| | | 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.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.util.ObjectUtils; |
| | | 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("å 餿µè¯æ 忍¡åæ°æ®") |
| | | @DeleteMapping("/delete") |
| | | @ApiOperation("1ãå页æ¥è¯¢é¡¹ç®") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(value = "æµè¯æ åID", name = "productId", dataTypeClass = String.class) |
| | | @ApiImplicitParam(name = "pageNo", value = "èµ·å§é¡µ", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "pageSize", value = "æ¯ä¸é¡µæ°é", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(value = "åææç¼ç /åææåç§°", name = "productCodeOrName", dataTypeClass = String.class) |
| | | }) |
| | | public Result<?> deleteProductInformation(Integer productId) { |
| | | Integer isDeleteProduct = productService.deleteProductInformation(productId); |
| | | if (isDeleteProduct == 1) { |
| | | return Result.success("å 餿åï¼"); |
| | | @GetMapping("/page") |
| | | public Result<?> pageProductInformation(Integer pageNo, Integer pageSize,String productCodeOrName) { |
| | | IPage<Map<String, Object>> maps = productService.pageProductInformation(productCodeOrName, new Page<Objects>(pageNo, pageSize)); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("row", maps.getRecords()); |
| | | map.put("total", maps.getTotal()); |
| | | return Result.success(map); |
| | | } |
| | | return Result.fail("å é¤å¤±è´¥ï¼"); |
| | | |
| | | @ApiOperation("2ãæ ¹æ®ç¶ç±»æ¥åç±»") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(value = "ç¶ç±»åç§°", name = "fatherName", dataTypeClass = String.class) |
| | | }) |
| | | @GetMapping("/father") |
| | | public Result<?> pageFatherNameProductInformation(String fatherName) { |
| | | List<Map<String, Object>> maps = productService.pageFatherNameProductInformation(fatherName); |
| | | return Result.success(maps); |
| | | } |
| | | } |
| | |
| | | package com.yuanchu.limslaboratory.controller; |
| | | |
| | | |
| | | import com.yuanchu.limslaboratory.pojo.dto.AddSpecifications; |
| | | import com.yuanchu.limslaboratory.pojo.dto.AddStandardDto; |
| | | import com.yuanchu.limslaboratory.service.SpecificationsService; |
| | | import com.yuanchu.limslaboratory.vo.Result; |
| | | import io.swagger.annotations.Api; |
| | |
| | | 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.*; |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private SpecificationsService specificationsService; |
| | | |
| | | @ApiOperation("æ·»å ç©æ") |
| | | @PostMapping("/add") |
| | | public Result<?> addSpecificationsInformation(@Validated @RequestBody AddSpecifications addSpecifications) { |
| | | Integer isMaterialSuccess = specificationsService.addSpecificationsInformation(addSpecifications); |
| | | if (isMaterialSuccess == 1) { |
| | | return Result.success("æ·»å ç©æã"+ addSpecifications.getSpecificationsName() +"ãæåï¼"); |
| | | } |
| | | return Result.fail("æ·»å ç©æã"+ addSpecifications.getSpecificationsName() +"ã失败ï¼"); |
| | | } |
| | | |
| | | @ApiOperation("å é¤äº§åè§æ ¼") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "specificationsId", value = "è§æ ¼Id", dataTypeClass = Integer.class, required = true) |
| | |
| | | package com.yuanchu.limslaboratory.controller; |
| | | |
| | | |
| | | import com.yuanchu.limslaboratory.pojo.dto.AddStandardDto; |
| | | import com.yuanchu.limslaboratory.service.StandardService; |
| | | import com.yuanchu.limslaboratory.vo.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private StandardService standardService; |
| | | |
| | | @ApiOperation("æ·»å ç©æ") |
| | | @PostMapping("/add") |
| | | public Result<?> addStandardInformation(@Validated @RequestBody AddStandardDto addStandardDto) { |
| | | Integer isMaterialSuccess = standardService.addStandardInformation(addStandardDto); |
| | | if (isMaterialSuccess == 1) { |
| | | return Result.success("æ·»å ç©æã"+ addStandardDto.getStandardName() +"ãæåï¼"); |
| | | } |
| | | return Result.fail("æ·»å ç©æã"+ addStandardDto.getStandardName() +"ã失败ï¼"); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDå 餿°æ®") |
| | | @DeleteMapping("/delete") |
| | | public Result<?> deleteStandardsInformation(String standardsId) { |
| | | Integer isDeleteSuccess = standardService.deleteStandardsInformation(standardsId); |
| | | if (isDeleteSuccess == 1){ |
| | | public Result<?> deleteStandardsInformation(Integer standardsId) { |
| | | Integer isDeleteMaterialSuccess = standardService.deleteStandardInformation(standardsId); |
| | | if (isDeleteMaterialSuccess == 1) { |
| | | return Result.success("å 餿åï¼"); |
| | | } |
| | | return Result.fail("å é¤å¤±è´¥ï¼"); |
| | |
| | | public interface MaterialMapper extends BaseMapper<Material> { |
| | | |
| | | //æ¥è¯¢ç©æä¿¡æ¯ |
| | | List<Material> selectMaterialLimit(int num1,int num2); |
| | | List<Material> selectMaterialLimit(int num1,int num2, int type); |
| | | |
| | | //æ ¹æ®ç©æidæ¥è¯¢ç©æä¿¡æ¯ |
| | | Map selectMaterialById(String materialId); |
| | |
| | | package com.yuanchu.limslaboratory.mapper; |
| | | |
| | | 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.core.mapper.BaseMapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | List<Product> selectProductByMaterialId(String materialId); |
| | | |
| | | Map<String, Object> getProductInformation(Integer productId); |
| | | IPage<Map<String, Object>> pageProductInformation(String productCodeOrName, Page<Objects> page); |
| | | |
| | | Map<String, Object> selectOneChildren(Object father); |
| | | } |
| | |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-07-17 |
| | | */ |
| | | @Accessors(chain = true) |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @ApiModel(value="Material对象", description="") |
| | |
| | | |
| | | @ApiModelProperty(value = "ç©æid", hidden = true) |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private String id; |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "ç©æç¼ç ", example = "152453211563212", required = true) |
| | | @ApiModelProperty(value = "ç©æç¼ç ", hidden = true) |
| | | private String code; |
| | | |
| | | @ApiModelProperty(value = "ç©æåç§°", example = "ç³å¤´", required = true) |
| | |
| | | import io.swagger.models.auth.In; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @since 2023-07-11 |
| | | */ |
| | | @Data |
| | | @Accessors(chain = true) |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @ApiModel(value="Specifications对象", description="è§æ ¼") |
| | | public class Specifications implements Serializable { |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @since 2023-07-11 |
| | | */ |
| | | @Data |
| | | @Accessors(chain = true) |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @ApiModel(value="Standards对象", description="æ å") |
| | | public class Standard implements Serializable { |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.pojo.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @ApiModel(value="AddMaterialDto对象", description="") |
| | | public class AddMaterialDto { |
| | | |
| | | @NotNull(message = "ç©æç±»åä¸è½ä¸ºç©ºï¼") |
| | | @ApiModelProperty(value = "0ï¼åææï¼1ï¼æåï¼2ï¼åæå", example = "1", required = true) |
| | | private Integer type; |
| | | |
| | | @NotBlank(message = "ç©æåç§°ä¸è½ä¸ºç©ºï¼") |
| | | @ApiModelProperty(value = "ç©æåç§°", example = "ç³å¤´", required = true) |
| | | private String materialName; |
| | | |
| | | @NotBlank(message = "æ ååç§°ä¸è½ä¸ºç©ºï¼") |
| | | @ApiModelProperty(value = "æ ååç§°", example = "å
纤", required = true) |
| | | private String standardName; |
| | | |
| | | @NotBlank(message = "产åè§æ ¼åç§°ä¸è½ä¸ºç©ºï¼") |
| | | @ApiModelProperty(value = "产åè§æ ¼åç§°", example = "AB", required = true) |
| | | private String specificationsName; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.pojo.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @ApiModel(value="AddSpecifications对象", description="") |
| | | public class AddSpecifications { |
| | | |
| | | @NotNull(message = "æ åIDä¸è½ä¸ºç©ºï¼") |
| | | @ApiModelProperty(value = "æ åid", example = "1", required = true) |
| | | private Integer standardId; |
| | | |
| | | @NotBlank(message = "产åè§æ ¼åç§°ä¸è½ä¸ºç©ºï¼") |
| | | @ApiModelProperty(value = "产åè§æ ¼åç§°", example = "AB", required = true) |
| | | private String specificationsName; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.pojo.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @ApiModel(value="AddStandardDto对象", description="") |
| | | public class AddStandardDto { |
| | | |
| | | @NotNull(message = "ç©æIDä¸è½ä¸ºç©ºï¼") |
| | | @ApiModelProperty(value = "ç©æid", example = "1", required = true) |
| | | private Integer materialId; |
| | | |
| | | @NotBlank(message = "æ ååç§°ä¸è½ä¸ºç©ºï¼") |
| | | @ApiModelProperty(value = "æ ååç§°", example = "å
纤", required = true) |
| | | private String standardName; |
| | | |
| | | @NotBlank(message = "产åè§æ ¼åç§°ä¸è½ä¸ºç©ºï¼") |
| | | @ApiModelProperty(value = "产åè§æ ¼åç§°", example = "AB", required = true) |
| | | private String specificationsName; |
| | | |
| | | } |
| | |
| | | |
| | | import com.yuanchu.limslaboratory.pojo.Material; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.yuanchu.limslaboratory.pojo.dto.AddMaterialDto; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | */ |
| | | public interface MaterialService extends IService<Material> { |
| | | |
| | | List<Material> selectMaterialLimit(int pageSize,int countSize); |
| | | List<Material> selectMaterialLimit(int pageSize,int countSize, int type); |
| | | |
| | | Map selectMaterialById(String materialId); |
| | | |
| | |
| | | * @param materialId |
| | | * @return |
| | | */ |
| | | Integer deleteMaterialInformation(String materialId); |
| | | @Transactional(rollbackFor = Exception.class) |
| | | Integer deleteMaterialInformation(Integer materialId); |
| | | |
| | | /** |
| | | * å é¤çäºSpecificationsIdçç©ææ°æ® |
| | | * @param deleteSpecificationsId |
| | | * @return |
| | | * ä¸çº§æ·»å åæ° |
| | | */ |
| | | List<String> specificationsIdDeleteMaterial(List<Integer> deleteSpecificationsId); |
| | | @Transactional(rollbackFor = Exception.class) |
| | | Integer addMaterialInformation(AddMaterialDto addMaterialDto); |
| | | |
| | | /** |
| | | * å级å屿¾ç¤º |
| | | */ |
| | | List<Map<String, Object>> getFourLevelInformation(String specificationName); |
| | | } |
| | |
| | | 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; |
| | | |
| | | |
| | | /** |
| | |
| | | * @since 2023-07-17 |
| | | */ |
| | | public interface ProductService extends IService<Product> { |
| | | Integer deleteProductInformation(Integer productId); |
| | | void deleteProductInformation(List<Integer> SpecificationsId); |
| | | |
| | | void MaterialIdDeleteProduct(List<String> deleteMaterialId); |
| | | IPage<Map<String, Object>> pageProductInformation(String productCodeOrName, Page<Objects> page); |
| | | |
| | | List<Map<String, Object>> pageFatherNameProductInformation(String fatherName); |
| | | } |
| | |
| | | package com.yuanchu.limslaboratory.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.yuanchu.limslaboratory.pojo.Specifications; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.yuanchu.limslaboratory.pojo.Standard; |
| | | import com.yuanchu.limslaboratory.pojo.dto.AddSpecifications; |
| | | import com.yuanchu.limslaboratory.pojo.dto.AddStandardDto; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | Integer deleteSpecifications(Integer specificationsId); |
| | | |
| | | List<Integer> SerialNumberIdDeleteSpecifications(List<String> deleteSerialNumberId); |
| | | List<Integer> StandardIdDeleteSpecifications(List<Integer> deleteStandard); |
| | | |
| | | Integer addSpecificationsInformation(AddSpecifications addStandardDto); |
| | | } |
| | |
| | | |
| | | import com.yuanchu.limslaboratory.pojo.Standard; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.yuanchu.limslaboratory.pojo.dto.AddStandardDto; |
| | | import io.swagger.models.auth.In; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | /** |
| | | * æ ¹æ®æ åIdå 餿°æ® |
| | | * @param standardsId |
| | | * @param materialId |
| | | * @return |
| | | */ |
| | | List<Integer> deleteStandardsInformation(Integer materialId); |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | Integer deleteStandardsInformation(String standardsId); |
| | | Integer deleteStandardInformation(Integer standardsId); |
| | | |
| | | Integer addStandardInformation(AddStandardDto addStandardDto); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.yuanchu.limslaboratory.pojo.Material; |
| | | import com.yuanchu.limslaboratory.mapper.MaterialMapper; |
| | | import com.yuanchu.limslaboratory.pojo.Specifications; |
| | | import com.yuanchu.limslaboratory.pojo.Standard; |
| | | import com.yuanchu.limslaboratory.pojo.dto.AddMaterialDto; |
| | | import com.yuanchu.limslaboratory.service.MaterialService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.limslaboratory.service.ProductService; |
| | | import com.yuanchu.limslaboratory.service.SpecificationsService; |
| | | import com.yuanchu.limslaboratory.service.StandardService; |
| | | import com.yuanchu.limslaboratory.utils.MyUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> implements MaterialService { |
| | | |
| | | @Resource |
| | | MaterialMapper materialMapper; |
| | | private MaterialMapper materialMapper; |
| | | |
| | | @Autowired |
| | | private StandardService standardService; |
| | | |
| | | @Autowired |
| | | private SpecificationsService specificationsService; |
| | | |
| | | @Autowired |
| | | private ProductService productService; |
| | | |
| | | //æ¥è¯¢ç©æä¿¡æ¯ |
| | | @Override |
| | | public List<Material> selectMaterialLimit(int pageSize, int countSize) { |
| | | return materialMapper.selectMaterialLimit((pageSize - 1) * countSize,pageSize * countSize); |
| | | public List<Material> selectMaterialLimit(int pageSize, int countSize, int type) { |
| | | return materialMapper.selectMaterialLimit((pageSize - 1) * countSize,pageSize * countSize, type); |
| | | } |
| | | |
| | | //æ ¹æ®ç©æidæ¥è¯¢ç©æä¿¡æ¯ |
| | |
| | | return materialMapper.selectMaterialById(materialId); |
| | | } |
| | | |
| | | @Autowired |
| | | private ProductService productService; |
| | | |
| | | @Override |
| | | public Integer deleteMaterialInformation(String materialId) { |
| | | public Integer deleteMaterialInformation(Integer materialId) { |
| | | LambdaUpdateWrapper<Material> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(Material::getId, materialId); |
| | | updateWrapper.set(Material::getState, 0); |
| | | List<String> list = new ArrayList<>(); |
| | | list.add(materialId); |
| | | int isDeleteSuccess = materialMapper.update(new Material(), updateWrapper); |
| | | if (isDeleteSuccess == 1){ |
| | | productService.MaterialIdDeleteProduct(list); |
| | | List<Integer> isDeleteStandard = standardService.deleteStandardsInformation(materialId); |
| | | if (!ObjectUtils.isEmpty(isDeleteStandard)){ |
| | | List<Integer> idDeleteSpecifications = specificationsService.StandardIdDeleteSpecifications(isDeleteStandard); |
| | | if (!ObjectUtils.isEmpty(idDeleteSpecifications)){ |
| | | productService.deleteProductInformation(idDeleteSpecifications); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public List<String> specificationsIdDeleteMaterial(List<Integer> deleteSpecificationsId) { |
| | | List<String> list = new ArrayList<>(); |
| | | for (Integer serialNumberId:deleteSpecificationsId){ |
| | | LambdaQueryWrapper<Material> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.select(Material::getId); |
| | | List<Material> maps1 = materialMapper.selectList(wrapper); |
| | | for (Material material:maps1){ |
| | | LambdaUpdateWrapper<Material> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(Material::getId, material.getId()); |
| | | updateWrapper.set(Material::getState, 0); |
| | | materialMapper.update(new Material(), updateWrapper); |
| | | list.add(material.getId()); |
| | | public Integer addMaterialInformation(AddMaterialDto addMaterialDto) { |
| | | Material material = new Material() |
| | | .setCode("BZ" + IdWorker.getIdStr()) |
| | | .setName(addMaterialDto.getMaterialName()) |
| | | .setType(addMaterialDto.getType()); |
| | | int isInsertSuccess = materialMapper.insert(material); |
| | | if (isInsertSuccess > 0){ |
| | | Standard standard = new Standard() |
| | | .setMaterialId(material.getId()) |
| | | .setName(addMaterialDto.getStandardName()); |
| | | boolean save = standardService.save(standard); |
| | | if (save){ |
| | | Specifications specifications = new Specifications() |
| | | .setName(addMaterialDto.getSpecificationsName()) |
| | | .setStandardId(standard.getId()); |
| | | boolean save1 = specificationsService.save(specifications); |
| | | if (save1) |
| | | return 1; |
| | | } |
| | | } |
| | | return list; |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getFourLevelInformation(String specificationName) { |
| | | LambdaQueryWrapper<Material> typeWrapper = new LambdaQueryWrapper<>(); |
| | | typeWrapper.groupBy(Material::getType); |
| | | typeWrapper.select(Material::getType); |
| | | List<Map<String, Object>> typeMaps = materialMapper.selectMaps(typeWrapper); |
| | | for (Map<String, Object> typeMap : typeMaps){ |
| | | LambdaQueryWrapper<Material> materialWrapper = new LambdaQueryWrapper<>(); |
| | | materialWrapper.eq(Material::getType, typeMap.get("type")); |
| | | materialWrapper.select(Material::getId, Material::getName); |
| | | List<Map<String, Object>> materialMaps = materialMapper.selectMaps(materialWrapper); |
| | | if (!ObjectUtils.isEmpty(materialMaps)){ |
| | | for (Map<String, Object> materialMap : materialMaps){ |
| | | LambdaQueryWrapper<Standard> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(Standard::getMaterialId, materialMap.get("id")); |
| | | wrapper.select(Standard::getId, Standard::getName); |
| | | List<Map<String, Object>> standardMaps = standardService.listMaps(wrapper); |
| | | if (!ObjectUtils.isEmpty(standardMaps)){ |
| | | for (Map<String, Object> standardMap : standardMaps){ |
| | | LambdaQueryWrapper<Specifications> specificationWrapper = new LambdaQueryWrapper<>(); |
| | | MyUtil.PrintLog(standardMap.get("id").toString()); |
| | | specificationWrapper.eq(Specifications::getStandardId, standardMap.get("id")); |
| | | if (!ObjectUtils.isEmpty(specificationName)){ |
| | | specificationWrapper.eq(Specifications::getName, specificationName); |
| | | } |
| | | specificationWrapper.select(Specifications::getId, Specifications::getName); |
| | | List<Map<String, Object>> specificationsMaps = specificationsService.listMaps(specificationWrapper); |
| | | if (!ObjectUtils.isEmpty(specificationsMaps)){ |
| | | standardMap.put("children", specificationsMaps); |
| | | } else { |
| | | standardMap.put("children", null); |
| | | } |
| | | } |
| | | materialMap.put("children", standardMaps); |
| | | } else { |
| | | materialMap.put("children", null); |
| | | } |
| | | } |
| | | typeMap.put("children", materialMaps); |
| | | } else { |
| | | typeMap.put("children", null); |
| | | } |
| | | } |
| | | return typeMaps; |
| | | } |
| | | } |
| | |
| | | |
| | | 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.pojo.Product; |
| | | import com.yuanchu.limslaboratory.mapper.ProductMapper; |
| | | 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 java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private ProductMapper productMapper; |
| | | |
| | | @Override |
| | | public Integer deleteProductInformation(Integer productId) { |
| | | public void deleteProductInformation(List<Integer> SpecificationsId) { |
| | | for (Integer materialId : SpecificationsId){ |
| | | LambdaUpdateWrapper<Product> wrapper = new LambdaUpdateWrapper<>(); |
| | | wrapper.eq(Product::getId, productId); |
| | | wrapper.set(Product::getState, 0); |
| | | return productMapper.update(new Product(), wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public void MaterialIdDeleteProduct(List<String> deleteMaterialId) { |
| | | for (String materialId : deleteMaterialId){ |
| | | LambdaUpdateWrapper<Product> wrapper = new LambdaUpdateWrapper<>(); |
| | | wrapper.eq(Product::getId, materialId); |
| | | wrapper.eq(Product::getSpecifications_id, materialId); |
| | | wrapper.set(Product::getState, 0); |
| | | productMapper.update(new Product(), wrapper); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public IPage<Map<String, Object>> pageProductInformation(String productCodeOrName, Page<Objects> page) { |
| | | IPage<Map<String, Object>> iPage = productMapper.pageProductInformation(productCodeOrName, page); |
| | | List<Map<String, Object>> maps = iPage.getRecords(); |
| | | MyUtil.PrintLog(maps.toString()); |
| | | maps.forEach(map -> { |
| | | int num = Integer.parseInt(map.get("num").toString()); |
| | | boolean children = false; |
| | | if (num > 1){ |
| | | children = true; |
| | | } else { |
| | | Map<String, Object> product = productMapper.selectOneChildren(map.get("father")); |
| | | map.putAll(product); |
| | | } |
| | | map.put("children", children); |
| | | map.remove("num"); |
| | | }); |
| | | return iPage; |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> pageFatherNameProductInformation(String fatherName) { |
| | | LambdaQueryWrapper<Product> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(Product::getFather, fatherName); |
| | | wrapper.select(Product::getId, Product::getName, Product::getUnit, Product::getRequired, Product::getInternal); |
| | | return productMapper.selectMaps(wrapper); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.yuanchu.limslaboratory.pojo.Specifications; |
| | | import com.yuanchu.limslaboratory.mapper.SpecificationsMapper; |
| | | import com.yuanchu.limslaboratory.pojo.dto.AddSpecifications; |
| | | import com.yuanchu.limslaboratory.pojo.dto.AddStandardDto; |
| | | import com.yuanchu.limslaboratory.service.*; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | |
| | | private SpecificationsMapper specificationsMapper; |
| | | |
| | | @Autowired |
| | | private MaterialService materialService; |
| | | |
| | | @Autowired |
| | | private ProductService productService; |
| | | |
| | | @Override |
| | |
| | | list.add(specificationsId); |
| | | int isDeleteSuccess = specificationsMapper.update(new Specifications(), updateWrapper); |
| | | if (isDeleteSuccess == 1){ |
| | | List<String> deleteMaterialId = materialService.specificationsIdDeleteMaterial(list); |
| | | if (!ObjectUtils.isEmpty(deleteMaterialId)){ |
| | | productService.MaterialIdDeleteProduct(deleteMaterialId); |
| | | } |
| | | productService.deleteProductInformation(list); |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public List<Integer> SerialNumberIdDeleteSpecifications(List<String> deleteSerialNumberId) { |
| | | public List<Integer> StandardIdDeleteSpecifications(List<Integer> deleteStandard) { |
| | | List<Integer> list = new ArrayList<>(); |
| | | for (String serialNumberId:deleteSerialNumberId){ |
| | | for (Integer standard : deleteStandard){ |
| | | LambdaQueryWrapper<Specifications> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(Specifications::getId, serialNumberId); |
| | | wrapper.eq(Specifications::getStandardId, standard); |
| | | wrapper.select(Specifications::getId); |
| | | List<Specifications> maps1 = specificationsMapper.selectList(wrapper); |
| | | for (Specifications specifications:maps1){ |
| | |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public Integer addSpecificationsInformation(AddSpecifications addStandardDto) { |
| | | Specifications specifications = new Specifications() |
| | | .setName(addStandardDto.getSpecificationsName()) |
| | | .setStandardId(addStandardDto.getStandardId()); |
| | | return specificationsMapper.insert(specifications); |
| | | } |
| | | } |
| | |
| | | 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.toolkit.ObjectUtils; |
| | | import com.yuanchu.limslaboratory.mapper.StandardMapper; |
| | | import com.yuanchu.limslaboratory.pojo.Material; |
| | | import com.yuanchu.limslaboratory.pojo.Specifications; |
| | | import com.yuanchu.limslaboratory.pojo.Standard; |
| | | import com.yuanchu.limslaboratory.pojo.dto.AddStandardDto; |
| | | import com.yuanchu.limslaboratory.service.*; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Resource |
| | | private StandardMapper standardMapper; |
| | | |
| | | @Autowired |
| | | private UserService userService; |
| | | |
| | | @Lazy |
| | | @Autowired |
| | | private SpecificationsService specificationsService; |
| | | |
| | | @Autowired |
| | | private MaterialService materialService; |
| | | |
| | | @Autowired |
| | | private ProductService productService; |
| | | |
| | | |
| | | @Override |
| | | public Integer deleteStandardsInformation(String standardsId) { |
| | | public List<Integer> deleteStandardsInformation(Integer materialId) { |
| | | LambdaQueryWrapper<Standard> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(Standard::getMaterialId, materialId); |
| | | wrapper.select(Standard::getId); |
| | | List<Integer> list = new ArrayList<>(); |
| | | List<Standard> standards = standardMapper.selectList(wrapper); |
| | | for (Standard standard : standards){ |
| | | LambdaUpdateWrapper<Standard> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(Standard::getMaterialId, materialId); |
| | | updateWrapper.set(Standard::getState, 0); |
| | | standardMapper.update(new Standard(), updateWrapper); |
| | | list.add(standard.getId()); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public Integer deleteStandardInformation(Integer standardsId) { |
| | | LambdaUpdateWrapper<Standard> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(Standard::getId, standardsId); |
| | | updateWrapper.set(Standard::getState, 0); |
| | | List<Integer> list = new ArrayList<>(); |
| | | int isDeleteSuccess = standardMapper.update(new Standard(), updateWrapper); |
| | | if (isDeleteSuccess == 1){ |
| | | List<Integer> deleteSpecificationsId = specificationsService.SerialNumberIdDeleteSpecifications(null); |
| | | if (!ObjectUtils.isEmpty(deleteSpecificationsId)){ |
| | | List<String> deleteMaterialId = materialService.specificationsIdDeleteMaterial(deleteSpecificationsId); |
| | | if (!ObjectUtils.isEmpty(deleteMaterialId)){ |
| | | productService.MaterialIdDeleteProduct(deleteMaterialId); |
| | | list.add(standardsId); |
| | | List<Integer> idDeleteSpecifications = specificationsService.StandardIdDeleteSpecifications(list); |
| | | if (!ObjectUtils.isEmpty(idDeleteSpecifications)){ |
| | | productService.deleteProductInformation(idDeleteSpecifications); |
| | | } |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public Integer addStandardInformation(AddStandardDto addStandardDto) { |
| | | Standard standard = new Standard() |
| | | .setMaterialId(addStandardDto.getMaterialId()) |
| | | .setName(addStandardDto.getStandardName()); |
| | | int save = standardMapper.insert(standard); |
| | | if (save == 1){ |
| | | Specifications specifications = new Specifications() |
| | | .setName(addStandardDto.getSpecificationsName()) |
| | | .setStandardId(standard.getId()); |
| | | boolean save1 = specificationsService.save(specifications); |
| | | if (save1) |
| | | return 1; |
| | | } |
| | | return 0; |
| | |
| | | select id, name |
| | | from material |
| | | where state = 1 |
| | | and type = #{type} |
| | | order by create_time desc |
| | | limit #{num1},#{num2} |
| | | </select> |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.yuanchu.limslaboratory.mapper.ProductMapper"> |
| | | |
| | | <select id="pageProductInformation" resultType="map"> |
| | | SELECT COUNT(1) num, p.`father` |
| | | FROM product p |
| | | <if test="productCodeOrName != null and productCodeOrName != ''"> |
| | | WHERE p.`father` = #{productCodeOrName} |
| | | </if> |
| | | GROUP BY p.`father` |
| | | </select> |
| | | |
| | | <select id="selectOneChildren" resultType="map"> |
| | | SELECT p.`id`, p.`unit`, p.`required`, p.`internal` |
| | | FROM product p |
| | | WHERE p.`father` = #{father} |
| | | </select> |
| | | </mapper> |
| | |
| | | import com.yuanchu.limslaboratory.vo.NewPersonnelVo; |
| | | import com.yuanchu.limslaboratory.vo.PagePersonnelVo; |
| | | import com.yuanchu.limslaboratory.vo.UpdatePersonnelVo; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @return |
| | | */ |
| | | List<User> selectUser(); |
| | | |
| | | /** |
| | | * è·åææç¨æ·çåç§°ä¸Id |
| | | */ |
| | | List<Map<String, Object>> getUserNameAndId(); |
| | | } |
| | |
| | | import com.yuanchu.limslaboratory.vo.NewPersonnelVo; |
| | | import com.yuanchu.limslaboratory.vo.PagePersonnelVo; |
| | | import com.yuanchu.limslaboratory.vo.UpdatePersonnelVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getUserNameAndId() { |
| | | LambdaQueryWrapper<User> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.select(User::getId, User::getName); |
| | | return userMapper.selectMaps(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, String> selectUserByUserId(int userId) { |
| | | return userMapper.selectUserByUserId(userId); |
| | | } |