|
|
@@ -0,0 +1,341 @@
|
|
|
+<?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.dk.mdm.mapper.mst.ActivityMapper">
|
|
|
+
|
|
|
+ <!-- 通用设置 -->
|
|
|
+ <!-- 通用查询列 -->
|
|
|
+ <sql id="Base_Column_List">
|
|
|
+ activity_id, activity_name, activity_describe, activity_type, activity_status, begin_date, end_date, flg_banner, activity_path, activity_url, grade_code, fun_id, app_code, cp_ids, display_no, flg_valid, op_create_time, op_create_user_id, op_update_time, op_update_user_id, op_app_code, op_timestamp, op_db_user
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <!-- 通用查询映射结果 -->
|
|
|
+ <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.mst.Activity">
|
|
|
+ <id column="activity_id" property="activityId"/>
|
|
|
+ <result column="activity_name" property="activityName"/>
|
|
|
+ <result column="activity_describe" property="activityDescribe"/>
|
|
|
+ <result column="activity_type" property="activityType"/>
|
|
|
+ <result column="activity_status" property="activityStatus"/>
|
|
|
+ <result column="begin_date" property="beginDate" typeHandler="TimestampTypeHandler"/>
|
|
|
+ <result column="end_date" property="endDate" typeHandler="TimestampTypeHandler"/>
|
|
|
+ <result column="flg_banner" property="flgBanner"/>
|
|
|
+ <result column="activity_path" property="activityPath"/>
|
|
|
+ <result column="activity_url" property="activityUrl"/>
|
|
|
+ <result column="grade_code" property="gradeCode"/>
|
|
|
+ <result column="fun_id" property="funId" typeHandler="UuidTypeHandler"/>
|
|
|
+ <result column="app_code" property="appCode"/>
|
|
|
+ <result column="cp_ids" property="cpIds" typeHandler="IntListTypeHandler"/>
|
|
|
+ <result column="display_no" property="displayNo"/>
|
|
|
+ <result column="flg_valid" property="flgValid"/>
|
|
|
+ <result column="op_create_time" property="opCreateTime" typeHandler="TimestampTypeHandler"/>
|
|
|
+ <result column="op_create_user_id" property="opCreateUserId"/>
|
|
|
+ <result column="op_update_time" property="opUpdateTime" typeHandler="TimestampTypeHandler"/>
|
|
|
+ <result column="op_update_user_id" property="opUpdateUserId"/>
|
|
|
+ <result column="op_app_code" property="opAppCode"/>
|
|
|
+ <result column="op_timestamp" property="opTimestamp" typeHandler="TimestampTypeHandler"/>
|
|
|
+ <result column="op_db_user" property="opDbUser"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <!-- 通用条件列 -->
|
|
|
+ <sql id="Condition">
|
|
|
+ <where>
|
|
|
+ <if test="activityName != null and activityName != ''">
|
|
|
+ AND activity_name = #{activityName}
|
|
|
+ </if>
|
|
|
+ <if test="activityDescribe != null and activityDescribe != ''">
|
|
|
+ AND activity_describe = #{activityDescribe}
|
|
|
+ </if>
|
|
|
+ <if test="activityType != null and activityType != ''">
|
|
|
+ AND activity_type = #{activityType}
|
|
|
+ </if>
|
|
|
+ <if test="activityStatus != null and activityStatus != ''">
|
|
|
+ AND activity_status = #{activityStatus}
|
|
|
+ </if>
|
|
|
+ <if test="beginDate != null">
|
|
|
+ AND begin_date = #{beginDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null">
|
|
|
+ AND end_date = #{endDate}
|
|
|
+ </if>
|
|
|
+ <if test="flgBanner != null">
|
|
|
+ AND flg_banner = #{flgBanner}
|
|
|
+ </if>
|
|
|
+ <if test="activityPath != null and activityPath != ''">
|
|
|
+ AND activity_path = #{activityPath}
|
|
|
+ </if>
|
|
|
+ <if test="activityUrl != null and activityUrl != ''">
|
|
|
+ AND activity_url = #{activityUrl}
|
|
|
+ </if>
|
|
|
+ <if test="gradeCode != null and gradeCode != ''">
|
|
|
+ AND grade_code = #{gradeCode}
|
|
|
+ </if>
|
|
|
+ <if test="funId != null and funId != ''">
|
|
|
+ AND fun_id = #{funId}
|
|
|
+ </if>
|
|
|
+ <if test="appCode != null and appCode != ''">
|
|
|
+ AND app_code = #{appCode}
|
|
|
+ </if>
|
|
|
+ <if test="cpIds != null">
|
|
|
+ AND cp_ids = #{cpIds}
|
|
|
+ </if>
|
|
|
+ <if test="displayNo != null">
|
|
|
+ AND display_no = #{displayNo}
|
|
|
+ </if>
|
|
|
+ <if test="flgValid != null">
|
|
|
+ AND flg_valid = #{flgValid}
|
|
|
+ </if>
|
|
|
+ <if test="opCreateTime != null">
|
|
|
+ AND op_create_time = #{opCreateTime}
|
|
|
+ </if>
|
|
|
+ <if test="opCreateUserId != null">
|
|
|
+ AND op_create_user_id = #{opCreateUserId}
|
|
|
+ </if>
|
|
|
+ <if test="opUpdateTime != null">
|
|
|
+ AND op_update_time = #{opUpdateTime}
|
|
|
+ </if>
|
|
|
+ <if test="opUpdateUserId != null">
|
|
|
+ AND op_update_user_id = #{opUpdateUserId}
|
|
|
+ </if>
|
|
|
+ <if test="opAppCode != null and opAppCode != ''">
|
|
|
+ AND op_app_code = #{opAppCode}
|
|
|
+ </if>
|
|
|
+ <if test="opTimestamp != null">
|
|
|
+ AND op_timestamp = #{opTimestamp}
|
|
|
+ </if>
|
|
|
+ <if test="opDbUser != null and opDbUser != ''">
|
|
|
+ AND op_db_user = #{opDbUser}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <!-- 通用查询列 -->
|
|
|
+ <sql id="Base_Column_List_list">
|
|
|
+ tma.activity_id,
|
|
|
+ tma.activity_name,
|
|
|
+ tma.activity_describe,
|
|
|
+ tma.activity_type,
|
|
|
+ tma.activity_status,
|
|
|
+ tma.begin_date,
|
|
|
+ tma.end_date,
|
|
|
+ tma.flg_banner,
|
|
|
+ tma.activity_path,
|
|
|
+ tma.activity_url,
|
|
|
+ tma.grade_code,
|
|
|
+ tma.fun_id,
|
|
|
+ tma.app_code,
|
|
|
+ tma.cp_ids,
|
|
|
+ tma.display_no,
|
|
|
+ tma.flg_valid,
|
|
|
+ tma.op_create_time,
|
|
|
+ tma.op_create_user_id,
|
|
|
+ tma.op_update_time,
|
|
|
+ tma.op_update_user_id,
|
|
|
+ tma.op_app_code,
|
|
|
+ tma.op_timestamp,
|
|
|
+ tma.op_db_user
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <!-- 通用查询映射结果 -->
|
|
|
+ <resultMap id="BaseResultMap_list" type="com.dk.mdm.model.response.mst.ActivityResponse">
|
|
|
+ <id column="activity_id" property="activityId"/>
|
|
|
+ <result column="activity_name" property="activityName"/>
|
|
|
+ <result column="activity_describe" property="activityDescribe"/>
|
|
|
+ <result column="activity_type" property="activityType"/>
|
|
|
+ <result column="activity_status" property="activityStatus"/>
|
|
|
+ <result column="begin_date" property="beginDate" typeHandler="TimestampTypeHandler"/>
|
|
|
+ <result column="end_date" property="endDate" typeHandler="TimestampTypeHandler"/>
|
|
|
+ <result column="flg_banner" property="flgBanner"/>
|
|
|
+ <result column="activity_path" property="activityPath"/>
|
|
|
+ <result column="activity_url" property="activityUrl"/>
|
|
|
+ <result column="grade_code" property="gradeCode"/>
|
|
|
+ <result column="fun_id" property="funId" typeHandler="UuidTypeHandler"/>
|
|
|
+ <result column="app_code" property="appCode"/>
|
|
|
+ <result column="cp_ids" property="cpIds" typeHandler="IntListTypeHandler"/>
|
|
|
+ <result column="display_no" property="displayNo"/>
|
|
|
+ <result column="flg_valid" property="flgValid"/>
|
|
|
+ <result column="op_create_time" property="opCreateTime" typeHandler="TimestampTypeHandler"/>
|
|
|
+ <result column="op_create_user_id" property="opCreateUserId"/>
|
|
|
+ <result column="op_update_time" property="opUpdateTime" typeHandler="TimestampTypeHandler"/>
|
|
|
+ <result column="op_update_user_id" property="opUpdateUserId"/>
|
|
|
+ <result column="op_app_code" property="opAppCode"/>
|
|
|
+ <result column="op_timestamp" property="opTimestamp" typeHandler="TimestampTypeHandler"/>
|
|
|
+ <result column="op_db_user" property="opDbUser"/>
|
|
|
+ <result column="cp_name" property="cpName"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <!-- 通用条件列 -->
|
|
|
+ <sql id="Condition_list">
|
|
|
+ <where>
|
|
|
+ <if test="activityName != null and activityName != ''">
|
|
|
+ AND tma.activity_name = #{activityName}
|
|
|
+ </if>
|
|
|
+ <if test="activityDescribe != null and activityDescribe != ''">
|
|
|
+ AND tma.activity_describe = #{activityDescribe}
|
|
|
+ </if>
|
|
|
+ <if test="activityType != null and activityType != ''">
|
|
|
+ AND tma.activity_type = #{activityType}
|
|
|
+ </if>
|
|
|
+ <if test="activityStatus != null and activityStatus != ''">
|
|
|
+ AND tma.activity_status = #{activityStatus}
|
|
|
+ </if>
|
|
|
+ <if test="beginDate != null">
|
|
|
+ AND tma.begin_date = #{beginDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null">
|
|
|
+ AND tma.end_date = #{endDate}
|
|
|
+ </if>
|
|
|
+ <if test="flgBanner != null">
|
|
|
+ AND tma.flg_banner = #{flgBanner}
|
|
|
+ </if>
|
|
|
+ <if test="activityPath != null and activityPath != ''">
|
|
|
+ AND tma.activity_path = #{activityPath}
|
|
|
+ </if>
|
|
|
+ <if test="activityUrl != null and activityUrl != ''">
|
|
|
+ AND tma.activity_url = #{activityUrl}
|
|
|
+ </if>
|
|
|
+ <if test="gradeCode != null and gradeCode != ''">
|
|
|
+ AND tma.grade_code = #{gradeCode}
|
|
|
+ </if>
|
|
|
+ <if test="funId != null and funId != ''">
|
|
|
+ AND tma.fun_id = #{funId}
|
|
|
+ </if>
|
|
|
+ <if test="appCode != null and appCode != ''">
|
|
|
+ AND tma.app_code = #{appCode}
|
|
|
+ </if>
|
|
|
+ <if test="cpIds != null">
|
|
|
+ AND tma.cp_ids = #{cpIds}
|
|
|
+ </if>
|
|
|
+ <if test="displayNo != null">
|
|
|
+ AND tma.display_no = #{displayNo}
|
|
|
+ </if>
|
|
|
+ <if test="flgValid != null">
|
|
|
+ AND tma.flg_valid = #{flgValid}
|
|
|
+ </if>
|
|
|
+ <if test="opCreateTime != null">
|
|
|
+ AND tma.op_create_time = #{opCreateTime}
|
|
|
+ </if>
|
|
|
+ <if test="opCreateUserId != null">
|
|
|
+ AND tma.op_create_user_id = #{opCreateUserId}
|
|
|
+ </if>
|
|
|
+ <if test="opUpdateTime != null">
|
|
|
+ AND tma.op_update_time = #{opUpdateTime}
|
|
|
+ </if>
|
|
|
+ <if test="opUpdateUserId != null">
|
|
|
+ AND tma.op_update_user_id = #{opUpdateUserId}
|
|
|
+ </if>
|
|
|
+ <if test="opAppCode != null and opAppCode != ''">
|
|
|
+ AND tma.op_app_code = #{opAppCode}
|
|
|
+ </if>
|
|
|
+ <if test="opTimestamp != null">
|
|
|
+ AND tma.op_timestamp = #{opTimestamp}
|
|
|
+ </if>
|
|
|
+ <if test="opDbUser != null and opDbUser != ''">
|
|
|
+ AND tma.op_db_user = #{opDbUser}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <sql id="idsForeach">
|
|
|
+ <!-- 根据主键activityId批量操作 -->
|
|
|
+ WHERE activity_id in
|
|
|
+ <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <!-- 查询表dkic_a.t_mst_activity,(条件查询+分页)列表 -->
|
|
|
+ <select id="selectByCond" resultMap="BaseResultMap_list">
|
|
|
+ SELECT
|
|
|
+ <include refid="Base_Column_List_list"/>
|
|
|
+ , sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "activityTypeName"
|
|
|
+ , sys.f_get_name_i18n(tdk2.kind_name_i18n, #{i18n}) as "activityStatusName"
|
|
|
+ FROM dkic_a.t_mst_activity as tma
|
|
|
+ left JOIN sys.t_data_kind as tdk1 on tma.activity_type = tdk1.kind_code
|
|
|
+ left JOIN sys.t_data_kind as tdk2 on tma.activity_status = tdk2.kind_code
|
|
|
+ <include refid="Condition_list"/>
|
|
|
+ <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
|
|
|
+ limit #{end} offset #{start}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 查询表dkic_a.t_mst_activity,(条件查询)个数 -->
|
|
|
+ <select id="countByCond" resultType="Long">
|
|
|
+ SELECT
|
|
|
+ count(1)
|
|
|
+ FROM dkic_a.t_mst_activity as tma
|
|
|
+ <include refid="Condition_list"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 根据主键查询表dkic_a.t_mst_activity的一行数据 -->
|
|
|
+ <select id="selectById" resultMap="BaseResultMap_list">
|
|
|
+ SELECT
|
|
|
+ <include refid="Base_Column_List_list"/>
|
|
|
+ ,(SELECT COALESCE(array_to_string(array_agg(cp_name), ','),'')
|
|
|
+ FROM dkic_a.t_a_company
|
|
|
+ WHERE cp_id = ANY (tma.cp_ids)) AS cp_name
|
|
|
+ FROM dkic_a.t_mst_activity as tma
|
|
|
+ WHERE activity_id = #{activityId}::uuid
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 根据主键锁定表dkic_a.t_mst_activity的一行数据 -->
|
|
|
+ <select id="selectByIdForUpdate" resultMap="BaseResultMap">
|
|
|
+ SELECT
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ FROM dkic_a.t_mst_activity
|
|
|
+ WHERE activity_id = #{activityId}
|
|
|
+ for update
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 根据主键锁定表dkic_a.t_mst_activity的多行数据 -->
|
|
|
+ <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
|
|
|
+ SELECT
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ FROM dkic_a.t_mst_activity
|
|
|
+ <include refid="idsForeach"/>
|
|
|
+ for update
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertBatch">
|
|
|
+ insert into dkic_a.t_mst_activity
|
|
|
+ (
|
|
|
+ <trim suffixOverrides=",">
|
|
|
+ activity_name,
|
|
|
+ activity_describe,
|
|
|
+ activity_type,
|
|
|
+ activity_status,
|
|
|
+ begin_date,
|
|
|
+ end_date,
|
|
|
+ flg_banner,
|
|
|
+ activity_path,
|
|
|
+ activity_url,
|
|
|
+ grade_code,
|
|
|
+ fun_id,
|
|
|
+ app_code,
|
|
|
+ cp_ids,
|
|
|
+ display_no,
|
|
|
+ op_app_code,
|
|
|
+ </trim>
|
|
|
+ )
|
|
|
+ values
|
|
|
+ <foreach collection="list" index="index" item="item" separator=",">
|
|
|
+ (
|
|
|
+ <trim suffixOverrides=",">
|
|
|
+ #{item.activityName},
|
|
|
+ #{item.activityDescribe},
|
|
|
+ #{item.activityType},
|
|
|
+ #{item.activityStatus},
|
|
|
+ #{item.beginDate},
|
|
|
+ #{item.endDate},
|
|
|
+ #{item.flgBanner},
|
|
|
+ #{item.activityPath},
|
|
|
+ #{item.activityUrl},
|
|
|
+ #{item.gradeCode},
|
|
|
+ #{item.funId}::uuid,
|
|
|
+ #{item.appCode},
|
|
|
+ #{item.cpIds},
|
|
|
+ #{item.displayNo},
|
|
|
+ #{item.opAppCode},
|
|
|
+ </trim>
|
|
|
+ )
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+</mapper>
|