InspectionPointFillGroupMapper.java 2.0 KB
package com.skua.modules.inspection.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.skua.modules.inspection.entity.InspectionPointFillGroup;
import com.skua.modules.inspection.vo.InspectionPointFillGroupAndFillVO;
import com.skua.modules.inspection.vo.InspectionStructEquipVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 巡检点-填报组
 */
public interface InspectionPointFillGroupMapper extends BaseMapper<InspectionPointFillGroup> {

    @Select("SELECT\n" +
            "\tipfg.id,ipfg.inspection_fill_group_id,group_name,fill_name,fill_unit,fill_type,group_concat(choice_name order by ifc.sort SEPARATOR \"|\") choice_name,sys_struct_dict_id,equip_info_id\n" +
            "FROM\n" +
            "\tinspection_point_fill_group ipfg\n" +
            "\tLEFT JOIN inspection_fill_group ifg ON ipfg.inspection_fill_group_id = ifg.id \n" +
            "\tleft join inspection_fill_group_fill ifgf on  ifg.id = ifgf.inspection_fill_group_id\n" +
            "\tleft join inspection_fill ifi on ifgf.inspection_fill_id = ifi.id\n" +
            "\tleft join inspection_fill_choice ifc on ifi.id = ifc.inspection_fill_id ${ew.customSqlSegment}")
    List<InspectionPointFillGroupAndFillVO> getList(@Param(Constants.WRAPPER) QueryWrapper<InspectionPointFillGroupAndFillVO> inspectionPointFillGroupAndFillVOQueryWrapper);

    @Select("select 'sys_struct_dict' node_type,id,'' parent_id,struct_name title from sys_struct_dict ssd where ssd.depart_id = #{departId}\n" +
            "union all\n" +
            "select 'equip_info' node_type,ei.id,ssd.id parent_id,ei.equipment_name title from equipment_info ei left join sys_struct_dict ssd on " +
            " ei.structures = ssd.id where ssd.depart_id = #{departId}")
    List<InspectionStructEquipVO> getSysStructDictAndEquipInfo(@Param("departId") String departId);
}