TCompleteMonitorSetMapper.xml 5.5 KB
<?xml version="1.0" encoding="UTF-8"?>

<!--
  ~
  ~      Copyright (c) 2018-2025, lengleng All rights reserved.
  ~
  ~  Redistribution and use in source and binary forms, with or without
  ~  modification, are permitted provided that the following conditions are met:
  ~
  ~ Redistributions of source code must retain the above copyright notice,
  ~  this list of conditions and the following disclaimer.
  ~  Redistributions in binary form must reproduce the above copyright
  ~  notice, this list of conditions and the following disclaimer in the
  ~  documentation and/or other materials provided with the distribution.
  ~  Neither the name of the yifu4cloud.com developer nor the names of its
  ~  contributors may be used to endorse or promote products derived from
  ~  this software without specific prior written permission.
  ~  Author: lengleng (wangiegie@gmail.com)
  ~
  -->

<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="com.yifu.cloud.plus.v1.yifu.archives.mapper.TCompleteMonitorSetMapper">

  <resultMap id="tCompleteMonitorSetMap" type="com.yifu.cloud.plus.v1.yifu.archives.entity.TCompleteMonitorSet">
    <id property="id" column="ID"/>
    <result property="isMonitor" column="IS_MONITOR"/>
    <result property="contractType" column="CONTRACT_TYPE"/>
    <result property="contractTypeName" column="CONTRACT_TYPE_NAME"/>
    <result property="baseId" column="BASE_ID"/>
    <result property="createBy" column="CREATE_BY"/>
    <result property="updateBy" column="UPDATE_BY"/>
    <result property="updateName" column="UPDATE_NAME"/>
    <result property="createName" column="CREATE_NAME"/>
    <result property="createTime" column="CREATE_TIME"/>
    <result property="updateTime" column="UPDATE_TIME"/>
  </resultMap>
    <sql id="Base_Column_List">
                a.ID,
                a.IS_MONITOR,
                a.CONTRACT_TYPE,
                a.CONTRACT_TYPE_NAME,
                a.BASE_ID,
                a.CREATE_BY,
                a.UPDATE_BY,
                a.CREATE_NAME,
                a.CREATE_TIME,
                a.UPDATE_TIME,
                a.UPDATE_NAME
    </sql>
    <sql id="tCompleteMonitorSet_where">
        <if test="tCompleteMonitorSet != null">
                    <if test="tCompleteMonitorSet.id != null and tCompleteMonitorSet.id.trim() != ''">
                        AND a.ID = #{tCompleteMonitorSet.id}
                    </if>
                    <if test="tCompleteMonitorSet.isMonitor != null and tCompleteMonitorSet.isMonitor.trim() != ''">
                        AND a.IS_MONITOR = #{tCompleteMonitorSet.isMonitor}
                    </if>
                    <if test="tCompleteMonitorSet.contractType != null and tCompleteMonitorSet.contractType.trim() != ''">
                        AND a.CONTRACT_TYPE = #{tCompleteMonitorSet.contractType}
                    </if>
					<if test="tCompleteMonitorSet.contractTypeArray != null and tCompleteMonitorSet.contractTypeArray.length > 0">
						AND
						<foreach item="idStr" index="index" collection="tCompleteMonitorSet.contractTypeArray" open="("
								 separator=" or " close=")">
							a.CONTRACT_TYPE_NAME like concat('%',#{idStr},'%')
						</foreach>
					</if>
                    <if test="tCompleteMonitorSet.baseId != null and tCompleteMonitorSet.baseId.trim() != ''">
                        AND a.BASE_ID = #{tCompleteMonitorSet.baseId}
                    </if>
                    <if test="tCompleteMonitorSet.createBy != null and tCompleteMonitorSet.createBy.trim() != ''">
                        AND a.CREATE_BY = #{tCompleteMonitorSet.createBy}
                    </if>
                    <if test="tCompleteMonitorSet.updateBy != null and tCompleteMonitorSet.updateBy.trim() != ''">
                        AND a.UPDATE_BY = #{tCompleteMonitorSet.updateBy}
                    </if>
                    <if test="tCompleteMonitorSet.createName != null and tCompleteMonitorSet.createName.trim() != ''">
                        AND a.CREATE_NAME = #{tCompleteMonitorSet.createName}
                    </if>
                    <if test="tCompleteMonitorSet.updateName != null and tCompleteMonitorSet.updateName.trim() != ''">
                        AND a.UPDATE_NAME = #{tCompleteMonitorSet.updateName}
                    </if>
                    <if test="tCompleteMonitorSet.createTime != null">
                        AND a.CREATE_TIME = #{tCompleteMonitorSet.createTime}
                    </if>
                    <if test="tCompleteMonitorSet.updateTime != null">
                        AND a.UPDATE_TIME = #{tCompleteMonitorSet.updateTime}
                    </if>
        </if>
    </sql>
    <!--tCompleteMonitorSet简单分页查询-->
    <select id="getTCompleteMonitorSetPage" resultMap="tCompleteMonitorSetMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_complete_monitor_set a
        <where>
            1=1
            <include refid="tCompleteMonitorSet_where"/>
        </where>
    </select>

    <!-- 获取所有基础配置 -->
    <select id="getAllList" resultMap="tCompleteMonitorSetMap">
        SELECT
        	<include refid="Base_Column_List"/>
        FROM t_complete_monitor_set a
    </select>

	<!-- 获取已配置的合同类型,前端使用 -->
	<select id="getAllUseContractType" resultType="java.lang.String">
		SELECT
			GROUP_CONCAT(CONTRACT_TYPE)
		FROM t_complete_monitor_set a
		where a.id != '1'
		<if test="oldId != null and oldId.trim() != ''">
			AND a.ID != #{oldId}
		</if>
		limit 1
	</select>

</mapper>