Merge remote-tracking branch 'origin/master'
| | |
| | | import com.yuanchu.limslaboratory.pojo.vo.ReportVo; |
| | | import com.yuanchu.limslaboratory.service.ReportService; |
| | | 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.Api; |
| | |
| | | @ApiImplicitParam(name = "result", value = "å®¡æ ¸ç»è®º", dataTypeClass = String.class, required = true) |
| | | }) |
| | | @PostMapping("/check") |
| | | public Result check(@RequestHeader("token") String token, Integer id, String result) throws Exception { |
| | | public Result check(@RequestHeader("X-Token") String token, Integer id, String result) throws Exception { |
| | | Object object = RedisUtil.get(token); |
| | | Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(object), Map.class); |
| | | MyUtil.PrintLog(unmarshal + "-------id" + id + "=========" + result); |
| | | return Result.success(reportService.check((String) unmarshal.get("name"), id, result)); |
| | | } |
| | | |
| | |
| | | im.name materialName, |
| | | r.conclusion , |
| | | r.status , |
| | | r.approver , |
| | | check_time, |
| | | u.name |
| | | from lims_laboratory.report r |
| | |
| | | } |
| | | |
| | | @ApiOperation(value = "æ ååº-->ç©æ-->ä¾§è¾¹æ å级å±å¼") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(value = "åå·/åå·åç§°", name = "specificationName", dataTypeClass = String.class) |
| | | }) |
| | | @GetMapping("/list") |
| | | public Result<?> getFourLevelInformation(String specificationName) { |
| | | List<Map<String, Object>> fourLevelInformation = materialService.getFourLevelInformation(specificationName); |
| | | public Result<?> getFourLevelInformation() { |
| | | List<Map<String, Object>> fourLevelInformation = materialService.getFourLevelInformation(); |
| | | return Result.success(fourLevelInformation); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.controller; |
| | | |
| | | import com.yuanchu.limslaboratory.pojo.Organizational; |
| | | import com.yuanchu.limslaboratory.service.OrganizationalService; |
| | | 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.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.stereotype.Controller; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-08-23 01:13:37 |
| | | */ |
| | | @Api(tags = "å®éªå®¤ç®¡ç-->ç»ç»æ¶æ") |
| | | @RestController |
| | | @RequestMapping("/organizational") |
| | | public class OrganizationalController { |
| | | |
| | | @Autowired |
| | | private OrganizationalService organizationalService; |
| | | |
| | | @ApiOperation(value = "ä¾§è¾¹æ æ å±å¼") |
| | | @GetMapping("/list") |
| | | public Result<?> getFourLevelInformation() { |
| | | Map<String, Object> organizationalTree = organizationalService.OrganizationalTree(); |
| | | return Result.success(organizationalTree); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ·»å é¨é¨") |
| | | @PostMapping("/add") |
| | | public Result<?> addDepartment(@RequestBody @Validated Organizational organizational) { |
| | | Integer addDepartment = organizationalService.addDepartment(organizational); |
| | | if (addDepartment >= 1){ |
| | | return Result.success("æ·»å æåï¼"); |
| | | } |
| | | return Result.fail("æ·»å 失败ï¼"); |
| | | } |
| | | |
| | | @ApiOperation(value = "ä¿®æ¹é¨é¨") |
| | | @PutMapping("/add") |
| | | public Result<?> updateDepartment(Integer id, @RequestBody @Validated Organizational organizational) { |
| | | Integer addDepartment = organizationalService.updateDepartment(id, organizational); |
| | | if (addDepartment >= 1){ |
| | | return Result.success("æ´æ°æåï¼"); |
| | | } |
| | | return Result.fail("æ´æ°å¤±è´¥ï¼"); |
| | | } |
| | | |
| | | @ApiOperation(value = "å é¤é¨é¨") |
| | | @DeleteMapping("/delete") |
| | | public Result<?> deleteDepartment(Integer id) { |
| | | Integer deleteDepartment = organizationalService.deleteDepartment(id); |
| | | if (deleteDepartment >= 1){ |
| | | return Result.success("å 餿åï¼"); |
| | | } |
| | | return Result.fail("å é¤å¤±è´¥ï¼"); |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | }) |
| | | @PostMapping("/write") |
| | | public Result<?> write(Integer id, String required, String internal) { |
| | | return Result.success(productService.write(id, required, internal)); |
| | | Integer write = productService.write(id, required, internal); |
| | | if (write >= 1){ |
| | | return Result.success("æ´æ°æå"); |
| | | } |
| | | return Result.fail("æ´æ°å¤±è´¥"); |
| | | } |
| | | |
| | | @ApiOperation("项ç®Idå表å é¤") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "ids", value = "æ å项ç®ID", dataTypeClass = String.class, required = true) |
| | | }) |
| | | @DeleteMapping("/deleteList") |
| | | public Result<?> deleteList(String ids) { |
| | | MyUtil.PrintLog(ids); |
| | | productService.deleteList(ids); |
| | | return Result.success("å 餿å"); |
| | | } |
| | | } |
| | |
| | | Map selectMaterialById(String materialId); |
| | | |
| | | // å级æ |
| | | List<Map<String, Object>> FourTree(String specificationsName); |
| | | List<Map<String, Object>> FourTree(); |
| | | |
| | | |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.mapper; |
| | | |
| | | import com.yuanchu.limslaboratory.pojo.Organizational; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-08-23 01:13:37 |
| | | */ |
| | | public interface OrganizationalMapper extends BaseMapper<Organizational> { |
| | | |
| | | List<Map<String, Object>> OrganizationalTree(Integer father_id); |
| | | } |
| | |
| | | //å±ç¤ºè¯¥åå·ä¸çæ£éªé¡¹ç®è¦æ± |
| | | List<Map<String, Object>> pageProductInformation(Integer specificationsId); |
| | | |
| | | |
| | | |
| | | void deleteList(String ids); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-08-23 01:13:37 |
| | | */ |
| | | @Accessors(chain = true) |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @ApiModel(value="Material对象", description="") |
| | | public class Organizational implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主é®ID",hidden = true) |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @NotBlank(message = "é¨é¨åç§°ä¸è½ä¸ºç©ºï¼") |
| | | @ApiModelProperty(value = "é¨é¨åç§°", example = "å¼åé¨", required = true) |
| | | private String department; |
| | | |
| | | @NotBlank(message = "è¯·éæ©ä¸çº§é¨é¨ï¼") |
| | | @ApiModelProperty(value = "ä¸çº§é¨é¨ID", example = "1", required = true) |
| | | private Integer fatherId; |
| | | |
| | | @TableLogic(value = "1", delval = "0") |
| | | @ApiModelProperty(value = "é»è¾å é¤ æ£å¸¸>=1,å é¤<=0", hidden = true) |
| | | private Integer state; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @ApiModelProperty(value = "å建æ¶é´", hidden = true) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date createTime; |
| | | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @ApiModelProperty(value = "æ´æ°æ¶é´", hidden = true) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date updateTime; |
| | | } |
| | |
| | | /** |
| | | * å级å屿¾ç¤º |
| | | */ |
| | | List<Map<String, Object>> getFourLevelInformation(String specificationName); |
| | | List<Map<String, Object>> getFourLevelInformation(); |
| | | |
| | | |
| | | /** |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.service; |
| | | |
| | | import com.yuanchu.limslaboratory.pojo.Organizational; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-08-23 01:13:37 |
| | | */ |
| | | public interface OrganizationalService extends IService<Organizational> { |
| | | |
| | | Map<String, Object> OrganizationalTree(); |
| | | |
| | | Integer addDepartment(Organizational organizational); |
| | | |
| | | Integer updateDepartment(Integer id, Organizational organizational); |
| | | |
| | | Integer deleteDepartment(Integer id); |
| | | } |
| | |
| | | */ |
| | | Integer write(Integer id, String required, String internal); |
| | | |
| | | void deleteList(String ids); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getFourLevelInformation(String specificationName) { |
| | | return materialMapper.FourTree(specificationName); |
| | | public List<Map<String, Object>> getFourLevelInformation() { |
| | | return materialMapper.FourTree(); |
| | | } |
| | | |
| | | //æ·»å ææ -->éæ©æ ·ååç§° |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.yuanchu.limslaboratory.pojo.Organizational; |
| | | import com.yuanchu.limslaboratory.mapper.OrganizationalMapper; |
| | | import com.yuanchu.limslaboratory.service.EnterpriseService; |
| | | import com.yuanchu.limslaboratory.service.OrganizationalService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-08-23 01:13:37 |
| | | */ |
| | | @Service |
| | | public class OrganizationalServiceImpl extends ServiceImpl<OrganizationalMapper, Organizational> implements OrganizationalService { |
| | | |
| | | @Resource |
| | | private OrganizationalMapper organizationalMapper; |
| | | |
| | | @Autowired |
| | | private EnterpriseService enterpriseService; |
| | | |
| | | @Override |
| | | public Map<String, Object> OrganizationalTree() { |
| | | String firstEnterpriseName = enterpriseService.getFirstEnterpriseName(); |
| | | List<Map<String, Object>> mapList = organizationalMapper.OrganizationalTree(0); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", 0); |
| | | map.put("department", firstEnterpriseName); |
| | | map.put("children", mapList); |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public Integer addDepartment(Organizational organizational) { |
| | | return organizationalMapper.insert(organizational); |
| | | } |
| | | |
| | | @Override |
| | | public Integer updateDepartment(Integer id, Organizational organizational) { |
| | | LambdaUpdateWrapper<Organizational> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(Organizational::getId, id); |
| | | return organizationalMapper.update(organizational, updateWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public Integer deleteDepartment(Integer id) { |
| | | LambdaUpdateWrapper<Organizational> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(Organizational::getId, id); |
| | | updateWrapper.set(Organizational::getState, 0); |
| | | return organizationalMapper.update(new Organizational(), updateWrapper); |
| | | } |
| | | } |
| | |
| | | product.setId(id); |
| | | product.setRequired(required); |
| | | product.setInternal(internal); |
| | | productMapper.updateById(product); |
| | | return 1; |
| | | MyUtil.PrintLog(product.toString()); |
| | | return productMapper.updateById(product); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteList(String ids) { |
| | | productMapper.deleteList(ids); |
| | | } |
| | | |
| | | |
| | |
| | | FROM material m |
| | | LEFT JOIN (SELECT s.`id`, s.`name`, s.`material_id` FROM standard s WHERE s.`state` = 1) s |
| | | ON s.material_id = m.`id` |
| | | LEFT JOIN (SELECT f.`id`, f.`name`, f.`standard_id` FROM specifications f WHERE f.`state` = 1 |
| | | <if test="specificationsName != null and specificationsName != ''"> |
| | | AND f.`name` = #{specificationsName} |
| | | </if>) f |
| | | LEFT JOIN (SELECT f.`id`, f.`name`, f.`standard_id` FROM specifications f WHERE f.`state` = 1) f |
| | | ON f.standard_id = s.id |
| | | WHERE m.`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.OrganizationalMapper"> |
| | | |
| | | <resultMap id="OrganizationalMap" type="map"> |
| | | <id property="id" column="id"/> |
| | | <result property="department" column="department"/> |
| | | <collection property="children" select="OrganizationalTree" column="id" javaType="list"/> |
| | | </resultMap> |
| | | |
| | | <select id="OrganizationalTree" resultMap="OrganizationalMap"> |
| | | SELECT o.id, o.`department` FROM organizational o where o.`father_id` = #{father_id} |
| | | </select> |
| | | </mapper> |
| | |
| | | |
| | | <!--å±ç¤ºè¯¥åå·ä¸çæ£éªé¡¹ç®è¦æ±--> |
| | | <resultMap id="pageProductInformationMap" type="map"> |
| | | <id property="father" column="father"/> |
| | | <id property="name" column="father"/> |
| | | <collection property="children" resultMap="pageProductInformationTowMap" javaType="List"/> |
| | | </resultMap> |
| | | <resultMap id="pageProductInformationTowMap" type="map"> |
| | |
| | | where state = 1 |
| | | and specifications_id = #{specificationsId} |
| | | </select> |
| | | |
| | | <select id="deleteList"> |
| | | update lims_laboratory.product |
| | | set state=0 |
| | | where id in (${ids}) |
| | | </select> |
| | | </mapper> |
| | |
| | | public static String database_username = "user"; |
| | | public static String database_password= "123456"; |
| | | public static String author = "æ±èéµ·éç½ç»ç§ææéå
¬å¸"; |
| | | public static String model_name = "/cnas-server"; // å¦æä¸ºåå¸å¼å¡«å模ååç§°ï¼å¦æä¸æ¯åå¸å¼ä¸ºç©ºå³å¯ |
| | | public static String model_name = "/standard-server"; // å¦æä¸ºåå¸å¼å¡«å模ååç§°ï¼å¦æä¸æ¯åå¸å¼ä¸ºç©ºå³å¯ |
| | | public static String setParent = "com.yuanchu.limslaboratory"; // å
è·¯å¾ |
| | | public static void main(String[] args) { |
| | | String projectPath = System.getProperty("user.dir"); |
| | |
| | | package com.yuanchu.limslaboratory; |
| | | |
| | | import com.yuanchu.limslaboratory.mapper.OrganizationalMapper; |
| | | import com.yuanchu.limslaboratory.service.PlanService; |
| | | import com.yuanchu.limslaboratory.service.UserService; |
| | | import com.yuanchu.limslaboratory.utils.MyUtil; |
| | |
| | | class SysApplicationTests { |
| | | |
| | | @Resource |
| | | private PlanService planService; |
| | | private OrganizationalMapper organizationalMapper; |
| | | |
| | | @Resource |
| | | private UserService userService; |
| | | |
| | | @Test |
| | | void contextLoads() { |
| | | String newString = String.format("%06d", 77); |
| | | System.out.println("newString === " + newString); |
| | | |
| | | List<Map<String, Object>> test = organizationalMapper.OrganizationalTree(0); |
| | | MyUtil.PrintLog(test.toString()); |
| | | } |
| | | |
| | | @Test |
| | |
| | | */ |
| | | public interface EnterpriseService extends IService<Enterprise> { |
| | | |
| | | String getFirstEnterpriseName(); |
| | | } |
| | |
| | | package com.yuanchu.limslaboratory.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.yuanchu.limslaboratory.pojo.Enterprise; |
| | | import com.yuanchu.limslaboratory.mapper.EnterpriseMapper; |
| | | import com.yuanchu.limslaboratory.service.EnterpriseService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class EnterpriseServiceImpl extends ServiceImpl<EnterpriseMapper, Enterprise> implements EnterpriseService { |
| | | |
| | | @Resource |
| | | private EnterpriseMapper enterpriseMapper; |
| | | |
| | | @Override |
| | | public String getFirstEnterpriseName() { |
| | | LambdaQueryWrapper<Enterprise> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.select(Enterprise::getName); |
| | | Enterprise enterprise = enterpriseMapper.selectOne(wrapper); |
| | | return enterprise.getName(); |
| | | } |
| | | } |