85 lines
4.6 KiB
XML
85 lines
4.6 KiB
XML
<?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.TurbineMapper">
|
|
|
|
<select id="queryBySelective" resultType="com.dite.znpt.domain.vo.TurbineListResp">
|
|
SELECT
|
|
t.turbine_id, t.project_id, p.project_name, t.turbine_name, t.turbine_code, t.turbine_desc, t.turbine_manufacturer, t.turbine_model, t.turbine_cover_url
|
|
FROM turbine t
|
|
LEFT JOIN project p ON t.project_id = p.project_id
|
|
<where>
|
|
<if test="keyword != null and keyword != ''">
|
|
and (t.turbine_name like concat('%', #{keyword,jdbcType=VARCHAR}, '%') or t.turbine_code like concat('%', #{keyword,jdbcType=VARCHAR}, '%'))
|
|
</if>
|
|
<if test="projectId != null and projectId != ''">
|
|
and t.project_id = #{projectId}
|
|
</if>
|
|
<if test="turbineDesc != null and turbineDesc != ''">
|
|
and t.turbine_desc like concat ('%', #{turbineDesc}, '%')
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<resultMap id="turbineInfoMap" type="com.dite.znpt.domain.vo.TurbineInfoResp">
|
|
<id property="turbineId" column="turbine_id"></id>
|
|
<result property="projectId" column="project_id"></result>
|
|
<result property="projectName" column="project_name"></result>
|
|
<result property="turbineName" column="turbine_name"></result>
|
|
<result property="turbineCode" column="turbine_code"></result>
|
|
<result property="turbineDesc" column="turbine_desc"></result>
|
|
<result property="turbineManufacturer" column="turbine_manufacturer"></result>
|
|
<result property="turbineModel" column="turbine_model"></result>
|
|
<result property="turbineCoverUrl" column="turbine_coverUrl"></result>
|
|
<collection property="partRespList" ofType="com.dite.znpt.domain.vo.PartResp">
|
|
<id property="partId" column="part_id"></id>
|
|
<result property="projectId" column="project_id"></result>
|
|
<result property="projectName" column="project_name"></result>
|
|
<result property="turbineId" column="turbine_id"></result>
|
|
<result property="turbineName" column="turbine_name"></result>
|
|
<result property="partName" column="part_name"></result>
|
|
<result property="partCode" column="part_code"></result>
|
|
<result property="partType" column="part_type"></result>
|
|
<result property="partDesc" column="part_desc"></result>
|
|
<result property="partManufacturer" column="part_manufacturer"></result>
|
|
<result property="partModel" column="part_model"></result>
|
|
</collection>
|
|
</resultMap>
|
|
|
|
<select id="listTurbineInfo" resultMap="turbineInfoMap">
|
|
SELECT
|
|
t.turbine_id, t.project_id, pr.project_name, t.turbine_name, t.turbine_code, t.turbine_desc, t.turbine_manufacturer, t.turbine_model, t.turbine_cover_url,
|
|
pa.part_id, pa.part_name, pa.part_code, pa.part_type, pa.part_desc, pa.part_manufacturer, pa.part_model
|
|
FROM turbine t
|
|
LEFT JOIN project pr ON t.project_id = pr.project_id
|
|
LEFT JOIN part pa ON t.turbine_id = pa.turbine_id
|
|
<where>
|
|
<if test="keyword != null and keyword != ''">
|
|
and (t.turbine_name like concat('%', #{keyword,jdbcType=VARCHAR}, '%') or t.turbine_code like concat('%', #{keyword,jdbcType=VARCHAR}, '%'))
|
|
</if>
|
|
<if test="projectId != null and projectId != ''">
|
|
and t.project_id = #{projectId}
|
|
</if>
|
|
<if test="turbineDesc != null and turbineDesc != ''">
|
|
and t.turbine_desc like concat ('%', #{turbineDesc}, '%')
|
|
</if>
|
|
<if test="turbineManufacturer != null and turbineManufacturer != ''">
|
|
and t.turbine_manufacturer like concat ('%', #{manufacturer}, '%')
|
|
</if>
|
|
<if test="turbineModel != null and turbineModel != ''">
|
|
and t.turbine_model like concat ('%', #{model}, '%')
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="getTurbineInfo" resultMap="turbineInfoMap">
|
|
SELECT
|
|
t.turbine_id, t.project_id, pr.project_name, t.turbine_name, t.turbine_code, t.turbine_desc, t.turbine_manufacturer, t.turbine_model, t.turbine_cover_url,
|
|
pa.part_id, pa.part_name, pa.part_code, pa.part_type, pa.part_desc, pa.part_manufacturer, pa.part_model
|
|
FROM turbine t
|
|
LEFT JOIN project pr ON t.project_id = pr.project_id
|
|
LEFT JOIN part pa ON t.turbine_id = pa.turbine_id
|
|
WHERE t.turbine_id = #{turbineId}
|
|
</select>
|
|
</mapper>
|
|
|