mobilebroken/nflg-mobilebroken-repository/src/main/resources/mapper/DeviceMapper.xml

71 lines
3.3 KiB
XML
Raw Normal View History

2025-01-19 11:30:15 +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.DeviceMapper">
<select id="getByDeviceNo" resultType="com.nflg.mobilebroken.common.pojo.vo.DeviceInfoVO">
2025-02-11 22:42:46 +08:00
SELECT d.device_no AS 'deviceNo',d.model_no AS 'modelNo',dc.component AS 'component',d.device_type AS 'deviceType'
,d.device_type_sub AS 'deviceTypeSub',d.warranty_state AS 'warrantyState',d.shipment_date AS 'shipmentDate'
,d.start_warranty_date AS 'startWarrantyDate',d.warranty_month AS 'warrantyMonth'
2025-01-19 11:30:15 +08:00
FROM device d
LEFT JOIN device_component dc ON d.model_no=dc.model_no AND dc.`enable`=1
2025-01-26 22:27:16 +08:00
WHERE d.device_no=#{deviceNo}
2025-01-19 11:30:15 +08:00
</select>
2025-01-25 23:30:44 +08:00
<sql id="whr">
<if test="query.deviceNo!=null and query.deviceNo!=''">
and device_no=#{query.deviceNo}
</if>
<if test="query.customerName!=null and query.customerName!=''">
and customer_name=#{query.customerName}
</if>
<if test="query.agentName!=null and query.agentName!=''">
and agent_name=#{query.agentName}
</if>
<if test="query.modelNo!=null and query.modelNo!=''">
and model_no=#{query.modelNo}
</if>
<if test="query.warrantyState!=null and query.warrantyState!=''">
and warranty_state=#{query.warrantyState}
</if>
<if test="query.warrantyStartDate!=null and query.warrantyStartDate!=''">
and start_warranty_date &gt;= #{query.warrantyStartDate} and start_warranty_date &lt;= #{query.warrantyEndDate}
</if>
</sql>
<select id="getList" resultType="com.nflg.mobilebroken.repository.entity.Device">
select * from device where data_valid_state=1
<include refid="whr"/>
</select>
<update id="batchDelByIds">
update device set data_valid_state=0 where id in
<foreach collection="ids" open="(" close=")" item="item" separator=",">
#{item}
</foreach>
</update>
2025-02-12 15:39:20 +08:00
<select id="searchDevice" resultType="com.nflg.mobilebroken.common.pojo.vo.DeviceVO">
SELECT d.device_no AS 'deviceNo',d.device_name AS 'deviceName',d.model_no AS 'modelNo',d.device_type AS 'deviceType',d.shipment_date AS 'shipmentDate'
FROM device d
INNER JOIN t_base_customer c ON d.agent_code=c.sap_customer_no
WHERE d.data_valid_state=1 AND c.id IN
<foreach collection="companyIds" open="(" close=")" item="companyId" separator=",">
#{companyId}
</foreach>
<where>
<if test="request.deviceNo!=null and request.deviceNo!=''">
and d.device_no LIKE concat('%', #{request.deviceNo}, '%')
</if>
<if test="request.modelNo!=null and request.modelNo!=''">
and d.model_no LIKE concat('%', #{request.modelNo}, '%')
</if>
<if test="request.startTime!=null and request.startTime!=''">
and d.shipment_date >= #{request.startTime}
</if>
<if test="request.endTime!=null and request.endTime!=''">
and d.shipment_date &lt;= #{request.endTime}
</if>
</where>
</select>
2025-01-19 11:30:15 +08:00
</mapper>