mobilebroken/nflg-mobilebroken-repository/src/main/resources/mapper/GongfuDeviceComponentMapper...

54 lines
2.3 KiB
XML
Raw Normal View History

2025-11-18 18:03:20 +08:00
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nflg.mobilebroken.repository.mapper.GongfuDeviceComponentMapper">
<select id="selectListByPage" resultType="com.nflg.mobilebroken.common.pojo.vo.DeviceComponentVO">
select * from gongfu_device_component
<where>
<if test="query.modelNo!=null and query.modelNo!=''">
and model_no like concat('%',#{query.modelNo} ,'%')
</if>
<if test="query.component!=null and query.component!=''">
and component like concat('%',#{query.component} ,'%')
</if>
</where>
<if test="query.componentSort==null">
ORDER BY id DESC
</if>
<if test="query.componentSort==true">
ORDER BY LENGTH(component) DESC,id DESC
</if>
<if test="query.componentSort==false">
ORDER BY LENGTH(component),id DESC
</if>
</select>
<select id="getExportData" resultType="com.nflg.mobilebroken.common.pojo.dto.GongFuDeviceComponentExportDTO">
select a.product_line,b.model_part_name,b.create_by,b.create_time
2025-11-18 18:03:20 +08:00
from gongfu_device_component a
join gongfu_device_component_detail b on a.id=b.device_component_id
join gongfu_device_part c on b.model_part_id=c.id
2025-11-18 18:03:20 +08:00
</select>
<select id="getWithDeviceType" resultType="com.nflg.mobilebroken.common.pojo.vo.DeviceComponent1VO">
SELECT d.device_type, dc.id, dc.model_no
FROM gongfu_device d
LEFT JOIN gongfu_device_component dc ON d.model_no = dc.model_no AND dc.`enable` = 1
WHERE d.data_valid_state = 1
<if test="modelNo!=null and modelNo!=''">
AND d.model_no = #{modelNo}
</if>
GROUP BY d.device_type, dc.id, dc.model_no
ORDER BY dc.id DESC
<!-- <if test="componentSort==null">-->
<!-- ORDER BY dc.id DESC-->
<!-- </if>-->
<!-- <if test="componentSort==true">-->
<!-- ORDER BY LENGTH(dc.component) > 0, dc.id DESC-->
<!-- </if>-->
<!-- <if test="componentSort==false">-->
<!-- ORDER BY LENGTH(dc.component) = 0, dc.id DESC-->
<!-- </if>-->
</select>
</mapper>