whycxzp
2023-12-08 e9d5503ee1a17a3a2c9b0b9880b711a4a62061d8
SOP查询逻辑更新
3个文件已修改
18 ■■■■■ 已修改文件
src/main/java/com/whyc/controller/SOPController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/SOPService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/SOPMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/SOPController.java
@@ -49,9 +49,9 @@
    @ApiOperation("查询sop信息")
    @PostMapping("getSopInfo")
    public Response getSopInfo(@RequestBody(required = false) List<SopDto> list
            , @RequestParam(required = false) String code, @RequestParam(required = false) String model
            , @RequestParam(required = false) String code, @RequestParam(required = false) String model, @RequestParam(required = false) Integer status
            , @RequestParam int pageCurr, @RequestParam int pageSize) {
        return service.getSopInfo(list,code,model,pageCurr,pageSize);
        return service.getSopInfo(list,code,model,status,pageCurr,pageSize);
    }
    @ApiOperation("查询sop历史")
src/main/java/com/whyc/service/SOPService.java
@@ -410,7 +410,7 @@
    }
    //查询sop信息
    public Response getSopInfo(List<SopDto> sqlList, String code, String model,int pageCurr,int pageSize) {
    public Response getSopInfo(List<SopDto> sqlList, String code, String model, Integer status, int pageCurr, int pageSize) {
        String sqlStr="  ";
        if(sqlList!=null&&sqlList.size()>0){
            for (SopDto dto:sqlList) {
@@ -418,11 +418,14 @@
                    for (int i=0;i<dto.getChileType().size();i++){
                        sqlStr+=" and file_type like "+"'%"+dto.getParentType()+"-"+dto.getChileType().get(i)+"%' ";
                    }
                }else{
                    sqlStr+=" and file_type like "+"'%"+dto.getParentType()+"%' ";
                }
            }
        }
        //排序
        sqlStr+=" order by create_time desc ";
        if(status!=null) {
            sqlStr += " and status = "+status;
        }
        List<SOP> list=mapper.getSopInfo(sqlStr,code,model);
        PageInfo pageInfo= PageInfoUtils.list2PageInfo(list,pageCurr,pageSize);
src/main/resources/mapper/SOPMapper.xml
@@ -25,12 +25,12 @@
        </collection>
    </resultMap>
    <select id="getSopInfo" resultMap="sopList">
        select tb_sop.*,tb_sop_product.id as pId,code,model,sop_id  from tb_sop LEFT JOIN tb_sop_product on tb_sop.id=tb_sop_product.sop_id where tb_sop.current_flag=1
        select tb_sop.*,tb_sop_product.id as pId,code,model,sop_id  from tb_sop LEFT JOIN tb_sop_product on tb_sop.id=tb_sop_product.sop_id where tb_sop.current_flag=1 ${sqlStr}
        union all
        select tb_sop.*,tb_sop_product.id as pId ,code,model,sop_id from tb_sop
        LEFT JOIN tb_sop_product on tb_sop.id=tb_sop_product.sop_id
        <where>
            1=1 and tb_sop.current_flag=0
            tb_sop.current_flag=0
            <if test="code!=null">
                and code LIKE '%${code}%'
            </if>
@@ -39,6 +39,7 @@
            </if>
            ${sqlStr}
        </where>
        order by create_time desc
    </select>
    <select id="getSopHis"  resultMap="sopList">
        select tb_sop.*,tb_sop_product.id as pId ,code,model,sop_id from tb_sop