• mybatisplus联表


    ________________________________controller
    @GetMapping("/pageTwo")
        @ApiOperation("")
        public R<IPage<SysDBasicsEquipment>> getsysDBasicsEquipmentService(SysDBasicsEquipment sysDBasicsEquipment , Page page) {

            return R.ok(sysDBasicsEquipmentService.getAllEquipmentList(sysDBasicsEquipment,page));
        }
        
        
        ________________________________service
        IPage<SysDBasicsEquipment> getAllEquipmentList(@Param("sysDBasicsEquipment") SysDBasicsEquipment sysDBasicsEquipment, Page page);
        
        ________________________________serviceimpl
        
         @Autowired
        private SysDBasicsEquipmentMapper sysDBasicsEquipmentMapper;
        @Override
        public IPage<SysDBasicsEquipment> getAllEquipmentList(SysDBasicsEquipment sysDBasicsEquipment, Page page) {
            return sysDBasicsEquipmentMapper.getAllEquipmentList(sysDBasicsEquipment,page);
        }
        
        ________________________________mapper
        IPage<SysDBasicsEquipment> getAllEquipmentList(@Param("sysDBasicsEquipment") SysDBasicsEquipment sysDBasicsEquipment, Page page);
        ________________________________mapper.xml
        
           <!-- 通用查询映射结果 -->
        <resultMap id="BaseResultMap" type="com.yuchai.zz.sys.entity.SysDBasicsEquipment">
            <result column="id" property="id" />
            <result column="equipment_id" property="equipmentId" />
            <result column="equipment_description" property="equipmentDescription" />
            <result column="factory" property="factory" />
            <result column="group_number" property="groupNumber" />
            <result column="operation" property="operation" />

        <collection property="sysOperationList" javaType="ArrayList" ofType="com.yuchai.zz.sys.entity.SysOperation">
            <result column="operation" property="operation" />
            <result column="description" property="description" />
        </collection>

            <collection property="sysTeamList" javaType="ArrayList" ofType="com.yuchai.zz.sys.entity.SysTeam">
                <result column="code" property="code" />
                <result column="name" property="name" />
                <result column="workshop_code" property="workshopCode" />
                <result column="workshop_name" property="workshopName" />
            </collection>

        </resultMap>

        <!-- 通用查询结果列 -->
        <sql id="Base_Column_List">
            id, equipment_id, equipment_description, factory, group_number, operation
        </sql>

        <select id="getAllEquipmentList" resultMap="BaseResultMap">
            SELECT sdbe.id,sdbe.equipment_id,sdbe.equipment_description,sdbe.factory,st.workshop_name,sdbe.group_number,st.name,sdbe.operation,so.description
            FROM sys_d_basics_equipment sdbe
            LEFT JOIN sys_operation so ON sdbe.operation  = so.operation
            LEFT JOIN sys_team st ON sdbe.group_number = st.code AND sdbe.factory = st.workshop_code
            <where>
                <if test="sysDBasicsEquipment.equipmentId != null and sysDBasicsEquipment.equipmentId != ''">
                    and equipment_id =#{sysDBasicsEquipment.equipmentId}
                </if>
                <if test="sysDBasicsEquipment.factory != null and sysDBasicsEquipment.factory != ''">
                    and factory =#{sysDBasicsEquipment.factory}
                </if>
                <if test="sysDBasicsEquipment.groupNumber != null and sysDBasicsEquipment.groupNumber != ''">
                    and group_number =#{sysDBasicsEquipment.groupNumber}
                </if>
            </where>

        </select>

  • 相关阅读:
    窗口实训1
    课后练习----实现窗口的切换
    第五次实训作业继承
    课程总结
    999
    777777777777777777777
    7
    6
    5
    事件处理程序
  • 原文地址:https://www.cnblogs.com/csjoz/p/15502851.html
Copyright © 2020-2023  润新知