________________________________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>