Newer
Older
casic-metering-eqpt-xichang / casic-metering-dao / src / main / resources / mapper / system / RemindConfigMapper.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.casic.missiles.mapper.system.RemindConfigMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.casic.missiles.model.system.RemindConfig">
        <id column="id" property="id" />
        <result column="remind_name" property="remindName" />
        <result column="remind_time" property="remindTime" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
        <result column="create_user_id" property="createUserId" />
        <result column="create_user_name" property="createUserName" />
        <result column="create_dept_id" property="createDeptId" />
        <result column="create_dept_name" property="createDeptName" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, remind_name, remind_time,remind_type, create_time, update_time, create_user_id, create_user_name, create_dept_id, create_dept_name
    </sql>

    <select id="listScopePage" resultType="com.casic.missiles.model.system.RemindConfig">
        SELECT
            a.id as id,
            a.remind_name as remindName,
            a.remind_time as remindTime,
            a.remind_type as remindType,
            a.create_time as createTime,
            a.update_time as updateTime,
            a.create_user_id as createUserId,
            a.create_user_name as createUserName,
            a.create_dept_id as createDeptId,
            a.create_dept_name as createDeptName,
            a.equipment_ext as equipmentExt,
            a.task_ext as taskExt,
            GROUP_CONCAT(DISTINCT c.equipment_name) as equipmentNames,
            GROUP_CONCAT(DISTINCT d.task_name) as taskNames
        FROM
            eqpt_remind_config a
                LEFT JOIN eqpt_remind_relation b ON a.id = b.remind_id
                LEFT JOIN eqpt_equipment_model_info c ON ( b.model_id = c.id AND a.remind_type = '1' )
                LEFT JOIN eqpt_equipment_task_info d ON ( b.task_id = d.id AND a.remind_type = '2' )
        GROUP BY a.id
        <if test="remindName != null and remindName !=''">
            HAVING a.remind_name like concat('%',#{remindName},'%')
        </if>

    </select>

</mapper>