| | |
| | | import com.yuanchu.limslaboratory.pojo.Instrument; |
| | | import com.yuanchu.limslaboratory.pojo.MeteringPlan; |
| | | import com.yuanchu.limslaboratory.pojo.dto.SelectMeasurementLedgerDto; |
| | | import com.yuanchu.limslaboratory.pojo.dto.SelectMeteringPlanDto; |
| | | import com.yuanchu.limslaboratory.service.MeteringPlanService; |
| | | import com.yuanchu.limslaboratory.utils.JackSonUtil; |
| | | import com.yuanchu.limslaboratory.utils.RedisUtil; |
| | |
| | | } |
| | | |
| | | @ApiOperation("计é计åå页æ¥è¯¢") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "pageNo", value = "èµ·å§é¡µ", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "pageSize", value = "æ¯ä¸é¡µæ°é", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "measureCodeOrNameOrUnit", value = "æµéç¼ç /åç§°/åä½", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @GetMapping("/plan_page_list") |
| | | public Result<?> pagingQueryOfMeteringPlan(Integer pageNo, Integer pageSize, String measureCodeOrNameOrUnit) { |
| | | IPage<Map<String, Object>> page = meteringPlanService.pagingQueryOfMeteringPlan(measureCodeOrNameOrUnit, new Page<Objects>(pageNo, pageSize)); |
| | | return Result.success(page); |
| | | public Result<?> pagingQueryOfMeteringPlan(SelectMeteringPlanDto dto) { |
| | | return Result.success(meteringPlanService.pagingQueryOfMeteringPlan(dto)); |
| | | } |
| | | |
| | | @ApiOperation("计éå°è´¦å页æ¥è¯¢") |
| | |
| | | IPage<Map<String, Object>> page = meteringPlanService.pagingQueryOfMeasurementLedger(selectMeasurementLedgerDto); |
| | | return Result.success(page); |
| | | } |
| | | |
| | | @ApiOperation("æ¥è¯¢è®¡éä¿¡æ¯") |
| | | public Result<?> getPlanMeasureInstrument(Integer id){ |
| | | return Result.success(meteringPlanService.getPlanMeasureInstrument(id)); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.pojo.LimitPage; |
| | | import com.yuanchu.limslaboratory.pojo.MeteringPlan; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.yuanchu.limslaboratory.pojo.MeteringPlanAndInfo; |
| | | import com.yuanchu.limslaboratory.pojo.dto.SelectMeasurementLedgerDto; |
| | | import com.yuanchu.limslaboratory.pojo.dto.SelectMeteringPlanDto; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | |
| | | public interface MeteringPlanMapper extends BaseMapper<MeteringPlan> { |
| | | |
| | | IPage<Map<String, Object>> pagingQueryOfMeasurementLedger(Page<Objects> page,@Param("dto") SelectMeasurementLedgerDto dto); |
| | | |
| | | /** |
| | | * å页æ¥è¯¢è®¡å |
| | | * @param dto |
| | | * @param limitPage |
| | | * @return |
| | | */ |
| | | List<MeteringPlanAndInfo>limitConditionMeteringPlan(@Param("dto")SelectMeteringPlanDto dto, @Param("limitPage") LimitPage limitPage); |
| | | |
| | | |
| | | Map<String, Object>getTotal(@Param("dto")SelectMeteringPlanDto dto); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.pojo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @Author å¼ å®¾ |
| | | * @Date 2023/8/17 |
| | | */ |
| | | @Data |
| | | public class LimitPage implements Serializable { |
| | | |
| | | private Long start, end; |
| | | |
| | | public LimitPage(Long start, Long end) { |
| | | this.start = start; |
| | | this.end = end; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.pojo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author å¼ å®¾ |
| | | * @Date 2023/8/17 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @ApiModel(value="MeteringPlanAndInfo", description="") |
| | | public class MeteringPlanAndInfo implements Serializable { |
| | | |
| | | private Long id; |
| | | |
| | | private String createPerson; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd", iso = DateTimeFormat.ISO.DATE_TIME) |
| | | @ApiModelProperty(value = "å¼å§æ¥æ", example = "2023-07-06", required = true, dataType = "date") |
| | | private Date beginTime; |
| | | |
| | | private String plannedOrderNumber; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd", iso = DateTimeFormat.ISO.DATE_TIME) |
| | | @ApiModelProperty(value = "ç»ææ¥æ", example = "2023-07-06", required = true, dataType = "date") |
| | | private Date endTime; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd", iso = DateTimeFormat.ISO.DATE_TIME) |
| | | private Date createTime; |
| | | |
| | | private String measurePerson; |
| | | |
| | | private Integer status; |
| | | |
| | | private List<MetricalInformation>resultList; |
| | | |
| | | |
| | | } |
| | |
| | | private Long currentPage; |
| | | @ApiModelProperty(value = "æ¯é¡µå¤å°æ¡", example = "10", required = true) |
| | | private Long pageSize; |
| | | @ApiModelProperty(value = "仪å¨ç¼ç ", required = false) |
| | | private String code; |
| | | @ApiModelProperty(value = "仪å¨åç§°", required = false) |
| | | private String name; |
| | | @ApiModelProperty(value = "计éåä½", required = false) |
| | | private String unit; |
| | | @ApiModelProperty(value = "计ååå·", required = false) |
| | | private String plannedOrderNumber; |
| | | } |
| | |
| | | import com.yuanchu.limslaboratory.pojo.MeteringPlan; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.yuanchu.limslaboratory.pojo.dto.SelectMeasurementLedgerDto; |
| | | import com.yuanchu.limslaboratory.pojo.dto.SelectMeteringPlanDto; |
| | | |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | |
| | | |
| | | Integer addMeteringPlanInformation(MeteringPlan meteringPlan); |
| | | |
| | | IPage<Map<String, Object>> pagingQueryOfMeteringPlan(String measureCodeOrNameOrUnit, Page<Objects> page); |
| | | Map<String, Object> pagingQueryOfMeteringPlan(SelectMeteringPlanDto dto); |
| | | |
| | | IPage<Map<String, Object>> pagingQueryOfMeasurementLedger(SelectMeasurementLedgerDto selectMeasurementLedgerDto); |
| | | |
| | | Map<String, Object> getPlanMeasureInstrument(Integer id); |
| | | } |
| | |
| | | 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.LimitPage; |
| | | import com.yuanchu.limslaboratory.pojo.MeteringPlan; |
| | | import com.yuanchu.limslaboratory.mapper.MeteringPlanMapper; |
| | | import com.yuanchu.limslaboratory.pojo.MeteringPlanAndInfo; |
| | | import com.yuanchu.limslaboratory.pojo.dto.SelectMeasurementLedgerDto; |
| | | import com.yuanchu.limslaboratory.pojo.dto.SelectMeteringPlanDto; |
| | | import com.yuanchu.limslaboratory.service.MeteringPlanService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.limslaboratory.utils.MyUtil; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | } |
| | | |
| | | @Override |
| | | public IPage<Map<String, Object>> pagingQueryOfMeteringPlan(String measureCodeOrNameOrUnit, Page<Objects> page) { |
| | | |
| | | |
| | | |
| | | return null; |
| | | public Map<String, Object> pagingQueryOfMeteringPlan(SelectMeteringPlanDto dto) { |
| | | List<MeteringPlanAndInfo> page= meteringPlanMapper |
| | | .limitConditionMeteringPlan(dto,new LimitPage((dto.getCurrentPage()-1)*dto.getPageSize(), dto.getPageSize())); |
| | | page.forEach(l->{ |
| | | l.getResultList().forEach(r->{ |
| | | if (r.getResult() < 1) { |
| | | l.setStatus(0); |
| | | }else { |
| | | l.setStatus(1); |
| | | } |
| | | }); |
| | | l.setResultList(null); |
| | | }); |
| | | Map<String, Object>all=new HashMap<>(2); |
| | | all.put("total",meteringPlanMapper.getTotal(dto).get("num")); |
| | | all.put("list",page); |
| | | return all; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<Map<String, Object>> pagingQueryOfMeasurementLedger(SelectMeasurementLedgerDto dto) { |
| | | return meteringPlanMapper.pagingQueryOfMeasurementLedger(new Page<>(dto.getCurrentPage(),dto.getPageSize(),true),dto); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getPlanMeasureInstrument(Integer id) { |
| | | return null; |
| | | } |
| | | } |
| | |
| | | LEFT JOIN `user` u ON u.id = m.user_id |
| | | LEFT JOIN instrument i ON i.`id` = m.`instrument_id` |
| | | WHERE 1=1 |
| | | and (m.state=1 and i.state=1) |
| | | and (m.state=1 and i.state=1 and m.result is not null) |
| | | <if test="dto.code!=null and dto.code!=''"> |
| | | and i.`equipment_code` like concat('%',#{dto.code},'%') |
| | | and i.`equipment_code` like concat('%',#{dto.code},'%') |
| | | </if> |
| | | <if test="dto.name!=null and dto.name!=''"> |
| | | and i.`equipment_name` like concat('%',#{dto.name},'%') |
| | | and i.`equipment_name` like concat('%',#{dto.name},'%') |
| | | </if> |
| | | <if test="dto.name!=null and dto.name!=''"> |
| | | and i.measurement_unit like concat('%',#{dto.unit},'%') |
| | | and i.measurement_unit like concat('%',#{dto.unit},'%') |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="limitConditionMeteringPlan" resultMap="MeteringPlanAndInfoMap"> |
| | | SELECT p.id id, |
| | | u.`name` createName, |
| | | p.planned_order_number plannedOrderNumber, |
| | | p.begin_time beginTime, |
| | | p.end_time endTime, |
| | | IF(IFNULL(i.result, 0) > 0, 1, 0) status, |
| | | (SELECT name FROM `user` u WHERE p.measure_person = u.id) measureName, |
| | | i.`code` iCode, |
| | | p.create_time createTime |
| | | FROM (SELECT id, measure_person, create_Person, begin_Time, end_Time, planned_order_number, create_time |
| | | from metering_plan |
| | | where 1=1 |
| | | <if test="dto.plannedOrderNumber!=null and dto.plannedOrderNumber!=''"> |
| | | and planned_order_number=#{plannedOrderNumber} |
| | | </if> |
| | | LIMIT #{limitPage.start},#{limitPage.end}) p |
| | | LEFT JOIN metrical_information i ON p.id = i.plan |
| | | LEFT JOIN `user` u ON p.create_Person = u.id |
| | | where 1 = 1 |
| | | </select> |
| | | <select id="getTotal" resultType="java.util.Map"> |
| | | select count(id) num from metering_plan where 1=1 |
| | | <if test="dto.plannedOrderNumber!=null and dto.plannedOrderNumber!=''"> |
| | | and planned_order_number=#{plannedOrderNumber} |
| | | </if> |
| | | </select> |
| | | |
| | | <resultMap id="MeteringPlanAndInfoMap" type="meteringPlanAndInfo"> |
| | | <result property="id" column="id"/> |
| | | <result property="createPerson" column="createName"/> |
| | | <result property="beginTime" column="beginTime"/> |
| | | <result property="endTime" column="endTime"/> |
| | | <result property="plannedOrderNumber" column="plannedOrderNumber"/> |
| | | <result property="measurePerson" column="measureName"/> |
| | | <result property="createTime" column="createTime"/> |
| | | <collection property="resultList" ofType="MetricalInformation"> |
| | | <result property="code" column="iCode"/> |
| | | <result property="result" column="status"/> |
| | | </collection> |
| | | </resultMap> |
| | | </mapper> |
| | |
| | | FROM metrical_information m, `user` u |
| | | WHERE m.`user_id` = u.`id` |
| | | AND m.`state` = 1 |
| | | and result is not Null |
| | | AND m.`instrument_id` = #{InstrumentId} |
| | | </select> |
| | | </mapper> |