| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- <?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.sckw.slope.detection.dao.mysql.KwsProjectMapper">
- <resultMap id="BaseResultMap" type="com.sckw.slope.detection.model.dos.mysql.KwsProject">
- <!--@mbg.generated-->
- <!--@Table kws_project-->
- <id column="id" jdbcType="BIGINT" property="id"/>
- <result column="name" jdbcType="VARCHAR" property="name"/>
- <result column="mountain_id" jdbcType="VARCHAR" property="mountainId"/>
- <result column="company_id" jdbcType="VARCHAR" property="companyId"/>
- <result column="mountain_name" jdbcType="VARCHAR" property="mountainName"/>
- <result column="platform_name" jdbcType="VARCHAR" property="platformName"/>
- <result column="platform_address" jdbcType="VARCHAR" property="platformAddress"/>
- <result column="design_company" jdbcType="VARCHAR" property="designCompany"/>
- <result column="design_contacts" jdbcType="VARCHAR" property="designContacts"/>
- <result column="design_phone" jdbcType="VARCHAR" property="designPhone"/>
- <result column="build_company" jdbcType="VARCHAR" property="buildCompany"/>
- <result column="build_contacts" jdbcType="VARCHAR" property="buildContacts"/>
- <result column="build_phone" jdbcType="VARCHAR" property="buildPhone"/>
- <result column="remark" jdbcType="VARCHAR" property="remark"/>
- <result column="status" jdbcType="TINYINT" property="status"/>
- <result column="create_by" jdbcType="BIGINT" property="createBy"/>
- <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
- <result column="update_by" jdbcType="BIGINT" property="updateBy"/>
- <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
- <result column="del_flag" jdbcType="TINYINT" property="delFlag"/>
- </resultMap>
- <sql id="Base_Column_List">
- <!--@mbg.generated-->
- id,
- `name`,
- mountain_id,
- mountain_name,
- platform_name,
- platform_address,
- design_company,
- design_contacts,
- design_phone,
- build_company,
- build_contacts,
- build_phone,
- remark,
- `status`,
- create_by,
- create_time,
- update_by,
- update_time,
- del_flag,
- company_id
- </sql>
- <select id="selectByProjectParam" resultType="com.sckw.slope.detection.model.vo.ProjectVo">
- select
- <include refid="Base_Column_List">
- </include>
- from kws_project
- where del_flag = 0
- <if test="companyId != null and companyId != ''">
- and company_id = #{companyId,jdbcType=VARCHAR}
- </if>
- <if test="projectQueryDto.name != null and projectQueryDto.name != ''">
- and name like concat('%', #{projectQueryDto.name}, '%')
- </if>
- </select>
- <select id="selectDeviceByProjectId" resultType="com.sckw.slope.detection.model.vo.ProjectDeviceVO">
- SELECT a.id AS projectId,
- a.`name` AS projectName,
- c.id AS id,
- c.`name` AS NAME,
- d.device_type AS deviceType,
- d.manufacturer AS manufacturer,
- d.`name` AS modelName,
- c.create_time AS createTime
- FROM kws_project a
- LEFT JOIN kws_project_device b ON a.id = b.project_id
- LEFT JOIN kws_device c ON b.device_id = c.id
- LEFT JOIN kws_device_model d ON c.model_id = d.id
- WHERE a.del_flag = 0
- AND b.del_flag = 0
- AND c.del_flag = 0
- AND d.del_flag = 0
- AND a.id = #{projectId,jdbcType=BIGINT}
- </select>
- <select id="selectDeviceList" resultType="com.sckw.slope.detection.model.vo.ProjectDeviceVO">
- SELECT a.id AS projectId,
- a.`name` AS projectName,
- c.id AS id,
- c.`name` AS NAME,
- d.device_type AS deviceType,
- d.manufacturer AS manufacturer,
- d.`name` AS modelName,
- c.create_time AS createTime
- FROM kws_project a
- LEFT JOIN kws_project_device b ON a.id = b.project_id
- LEFT JOIN kws_device c ON b.device_id = c.id
- LEFT JOIN kws_device_model d ON c.model_id = d.id
- WHERE a.del_flag = 0
- AND b.del_flag = 0
- AND c.del_flag = 0
- AND d.del_flag = 0
- <if test="deviceQuery.projectId != null and deviceQuery.projectId != ''">
- AND a.id = #{deviceQuery.projectId}
- </if>
- <if test="deviceQuery.manufacturer != null and deviceQuery.manufacturer != ''">
- and d.manufacturer like concat('%', #{deviceQuery.manufacturer}, '%')
- </if>
- <if test="deviceQuery.deviceType != null and deviceQuery.deviceType != ''">
- and d.device_type like concat('%', #{deviceQuery.deviceType}, '%')
- </if>
- <if test="deviceQuery.name != null and deviceQuery.name != ''">
- and d.name like concat('%', #{deviceQuery.name}, '%')
- </if>
- </select>
- <select id="selectDeviceNotBindList" resultType="com.sckw.slope.detection.model.vo.ProjectDeviceVO">
- SELECT a.id AS projectId,
- a.`name` AS projectName,
- c.id AS id,
- c.`status` as status,
- c.`name` AS NAME,
- d.device_type AS deviceType,
- d.manufacturer AS manufacturer,
- d.`name` AS modelName,
- c.create_time AS createTime
- FROM kws_project a
- LEFT JOIN kws_device c ON a.mountain_id = c.mountain_id
- LEFT JOIN kws_device_model d ON c.model_id = d.id
- WHERE a.del_flag = 0
- AND c.del_flag = 0
- AND d.del_flag = 0
- AND c.id NOT in (SELECT DISTINCT a.relate_device_id
- FROM kws_device_relation a
- LEFT JOIN kws_project b ON a.mountain_id = b.mountain_id)
- AND c.id NOT in (SELECT DISTINCT a.device_id
- FROM kws_device_relation a
- LEFT JOIN kws_project b ON a.mountain_id = b.mountain_id)
- <if test="deviceQuery.projectId != null and deviceQuery.projectId != ''">
- AND a.id = #{deviceQuery.projectId}
- </if>
- <if test="deviceQuery.manufacturer != null and deviceQuery.manufacturer != ''">
- and d.manufacturer like concat('%', #{deviceQuery.manufacturer}, '%')
- </if>
- <if test="deviceQuery.deviceType != null and deviceQuery.deviceType != ''">
- and d.device_type like concat('%', #{deviceQuery.deviceType}, '%')
- </if>
- <if test="deviceQuery.name != null and deviceQuery.name != ''">
- and d.name like concat('%', #{deviceQuery.name}, '%')
- </if>
- </select>
- </mapper>
|