znpt-backend/core/src/main/resources/mapper/DefectMapper.xml

31 lines
1.2 KiB
XML
Raw Normal View History

2025-04-10 14:07:11 +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.dite.znpt.mapper.DefectMapper">
<sql id="Base_Column_List">
a.defect_id, a.turbine_id, a.part_id, a.defect_code, a.defect_name, a.defect_type, a.defect_level, a.defect_image_path, a.description
2025-04-10 14:07:11 +08:00
</sql>
<select id="queryBySelective" resultType="com.dite.znpt.domain.vo.DefectResp">
select
<include refid="Base_Column_List"/>
from defect a
<where>
<if test="keyword != null and keyword != ''">
# and (a.defect_name like concat('%', #{keyword,jdbcType=VARCHAR}, '%') or a.defect_code like concat('%', #{keyword,jdbcType=VARCHAR}, '%'))
2025-04-10 14:07:11 +08:00
</if>
<if test="partId != null and partId != ''">
and a.part_id = #{turbineCode}
2025-04-10 14:07:11 +08:00
</if>
2025-04-10 14:07:11 +08:00
<if test="defectType != null and defectType != ''">
and a.defect_type = #{defectType}
2025-04-10 14:07:11 +08:00
</if>
<if test="defectLevel != null and defectLevel != ''">
and a.defect_level = #{defectLevel}
2025-04-10 14:07:11 +08:00
</if>
</where>
</select>
</mapper>