|
|
@@ -17,10 +17,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<result property="alertNum" column="alert_num" />
|
|
|
<result property="userType" column="user_type" />
|
|
|
<result property="alertStatus" column="alert_status" />
|
|
|
+ <result property="salesLevel" column="sales_level" />
|
|
|
+ <result property="orgCode" column="org_code" />
|
|
|
+ <result property="orgName" column="org_name" />
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectAlertConfigurationVo">
|
|
|
- select alert_id, create_by, create_time, update_by, update_time, is_delete, alert_content, alert_start_time, alert_end_time, alert_num, user_type, alert_status from alert_configuration
|
|
|
+ select alert_id, create_by, create_time, update_by, update_time, is_delete, alert_content, alert_start_time, alert_end_time, alert_num, user_type, alert_status,sales_level,org_code,org_name from alert_configuration
|
|
|
</sql>
|
|
|
|
|
|
<select id="selectAlertConfigurationList" parameterType="AlertConfiguration" resultMap="AlertConfigurationResult">
|
|
|
@@ -36,13 +39,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</where>
|
|
|
</select>
|
|
|
|
|
|
- <select id="selectAlertConfigurationListFilter" resultType="java.lang.Integer">
|
|
|
- SELECT
|
|
|
- count(*)
|
|
|
- FROM
|
|
|
- alert_configuration
|
|
|
- WHERE alert_configuration.alert_status = 1
|
|
|
-
|
|
|
+ <select id="selectAlertConfigurationListFilter" parameterType="Long" resultMap="AlertConfigurationResult">
|
|
|
+ <include refid="selectAlertConfigurationVo"/>
|
|
|
+ WHERE alert_status = 1
|
|
|
+ <if test="userType !=null and userType !=''">
|
|
|
+ and user_type = #{userType}
|
|
|
+ </if>
|
|
|
</select>
|
|
|
|
|
|
<select id="selectAlertConfigurationById" parameterType="Long" resultMap="AlertConfigurationResult">
|
|
|
@@ -51,10 +53,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</select>
|
|
|
|
|
|
<select id="selectAlertConfigurationByAlertStatus" parameterType="Long" resultMap="AlertConfigurationResult">
|
|
|
- select *
|
|
|
- FROM
|
|
|
- alert_configuration
|
|
|
- WHERE alert_configuration.alert_status = 1
|
|
|
+ <include refid="selectAlertConfigurationVo"/>
|
|
|
+ WHERE alert_status = 1
|
|
|
+ <if test="userType !=null and userType !=''">
|
|
|
+ and user_type = #{userType}
|
|
|
+ </if>
|
|
|
</select>
|
|
|
|
|
|
<insert id="insertAlertConfiguration" parameterType="AlertConfiguration" useGeneratedKeys="true" keyProperty="alertId">
|
|
|
@@ -71,6 +74,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="alertNum != null ">alert_num,</if>
|
|
|
<if test="userType != null and userType != ''">user_type,</if>
|
|
|
<if test="alertStatus != null and alertStatus != ''">alert_status,</if>
|
|
|
+ <if test="salesLevel != null and salesLevel != ''">sales_level,</if>
|
|
|
+ <if test="orgCode != null and orgCode != ''">org_code,</if>
|
|
|
+ <if test="orgName != null and orgName != ''">org_name,</if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
|
@@ -84,6 +90,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="alertNum != null ">#{alertNum},</if>
|
|
|
<if test="userType != null and userType != ''">#{userType},</if>
|
|
|
<if test="alertStatus != null and alertStatus != ''">#{alertStatus},</if>
|
|
|
+ <if test="salesLevel != null and salesLevel != ''">#{salesLevel},</if>
|
|
|
+ <if test="orgCode != null and orgCode != ''">#{orgCode},</if>
|
|
|
+ <if test="orgName != null and orgName != ''">#{orgName},</if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
|
|
|
@@ -101,6 +110,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="alertNum != null ">alert_num = #{alertNum},</if>
|
|
|
<if test="userType != null and userType != ''">user_type = #{userType},</if>
|
|
|
<if test="alertStatus != null and alertStatus != ''">alert_status = #{alertStatus},</if>
|
|
|
+ <if test="salesLevel != null and salesLevel != ''">sales_level = #{salesLevel},</if>
|
|
|
+ <if test="orgCode != null and orgCode != ''">org_code = #{orgCode},</if>
|
|
|
+ <if test="orgName != null and orgName != ''">org_name = #{orgName},</if>
|
|
|
</trim>
|
|
|
where alert_id = #{alertId}
|
|
|
</update>
|
|
|
@@ -115,5 +127,122 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
#{alertId}
|
|
|
</foreach>
|
|
|
</delete>
|
|
|
-
|
|
|
+
|
|
|
+ <sql id="orgListWhere">
|
|
|
+ and cal_month = date_format( CURDATE(), '%Y%m' )
|
|
|
+ <if test="parType != null and parType == 'company_level'">
|
|
|
+ and company_code = #{parValue}
|
|
|
+ </if>
|
|
|
+ <if test="parType != null and parType == 'saledept_level' ">
|
|
|
+ and saledept_code = #{parValue}
|
|
|
+ </if>
|
|
|
+ <if test="parType != null and parType == 'office_level'">
|
|
|
+ and office_code = #{parValue}
|
|
|
+ </if>
|
|
|
+ <if test="parType != null and parType == 'suboffice_level'">
|
|
|
+ and suboffice_code = #{parValue}
|
|
|
+ </if>
|
|
|
+ </sql>
|
|
|
+ <select id="selectOrgCodeByInterface" resultType="java.lang.String">
|
|
|
+ <if test="parType != null and parType == 'company_level' or parType == 'diy_level' ">
|
|
|
+ SELECT
|
|
|
+ company_code AS orgCode
|
|
|
+ FROM
|
|
|
+ order_sales_sum_tuc_group
|
|
|
+ WHERE
|
|
|
+ BUSINESS_UNIT = '零售'
|
|
|
+ <include refid="orgListWhere"/>
|
|
|
+ GROUP BY
|
|
|
+ company_code UNION
|
|
|
+ </if>
|
|
|
+ <if test="parType != null and parType == 'saledept_level' or parType == 'office_level' or parType == 'diy_level' ">
|
|
|
+ SELECT
|
|
|
+ saledept_code AS orgCode
|
|
|
+ FROM
|
|
|
+ order_sales_sum_tuc_group
|
|
|
+ WHERE
|
|
|
+ BUSINESS_UNIT = '零售'
|
|
|
+ <include refid="orgListWhere"/>
|
|
|
+ GROUP BY
|
|
|
+ saledept_code UNION
|
|
|
+ </if>
|
|
|
+ <if test="parType != null and parType == 'suboffice_level' or parType == 'diy_level' ">
|
|
|
+ SELECT
|
|
|
+ suboffice_code AS orgCode
|
|
|
+ FROM
|
|
|
+ order_sales_sum_tuc_group
|
|
|
+ WHERE
|
|
|
+ BUSINESS_UNIT = '零售'
|
|
|
+ <include refid="orgListWhere"/>
|
|
|
+ GROUP BY
|
|
|
+ suboffice_code
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <select id="selectOrgCode" resultType="java.lang.String">
|
|
|
+
|
|
|
+ SELECT
|
|
|
+ company_code AS orgCode
|
|
|
+ FROM
|
|
|
+ order_sales_sum_tuc_group
|
|
|
+ WHERE
|
|
|
+ BUSINESS_UNIT = '零售'
|
|
|
+ <include refid="orgListWhere"/>
|
|
|
+ GROUP BY
|
|
|
+ company_code UNION
|
|
|
+ SELECT
|
|
|
+ saledept_code AS orgCode
|
|
|
+ FROM
|
|
|
+ order_sales_sum_tuc_group
|
|
|
+ WHERE
|
|
|
+ BUSINESS_UNIT = '零售'
|
|
|
+ <include refid="orgListWhere"/>
|
|
|
+ GROUP BY
|
|
|
+ saledept_code UNION
|
|
|
+ SELECT
|
|
|
+ suboffice_code AS orgCode
|
|
|
+ FROM
|
|
|
+ order_sales_sum_tuc_group
|
|
|
+ WHERE
|
|
|
+ BUSINESS_UNIT = '零售'
|
|
|
+ <include refid="orgListWhere"/>
|
|
|
+ GROUP BY
|
|
|
+ suboffice_code
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="searchProductParamByCustomerCode" resultType="java.util.Map">
|
|
|
+ SELECT
|
|
|
+ g.company_code,
|
|
|
+ g.company_name,
|
|
|
+ g.office_code,
|
|
|
+ g.office_name,
|
|
|
+ g.suboffice_code,
|
|
|
+ g.suboffice_name
|
|
|
+ FROM
|
|
|
+ order_sales_sum_tuc_group g
|
|
|
+ left join tuc_company_sort sort on g.company_code=sort.company_code
|
|
|
+ WHERE
|
|
|
+ 1 = 1 AND g.BUSINESS_UNIT = '零售'
|
|
|
+ <if test="salesLevel != null and salesLevel == 'company_level' ">
|
|
|
+ and g.office_code is not null
|
|
|
+ and g.office_code !=''
|
|
|
+ and g.company_code = #{orgCode}
|
|
|
+
|
|
|
+ </if>
|
|
|
+ <if test="salesLevel != null and salesLevel == 'office_level'">
|
|
|
+ and g.suboffice_code is not null
|
|
|
+ and g.suboffice_code !=''
|
|
|
+ and g.office_code = #{orgCode}
|
|
|
+ </if>
|
|
|
+ <if test="salesLevel != null and salesLevel == 'suboffice_level' ">
|
|
|
+ and g.suboffice_code is not null
|
|
|
+ and g.suboffice_code !=''
|
|
|
+ and g.suboffice_code = #{orgCode}
|
|
|
+ </if>
|
|
|
+ <if test="groupByStr != null and groupByStr != ''">
|
|
|
+ GROUP BY g.${groupByStr}
|
|
|
+ </if>
|
|
|
+ <if test="salesLevel != null and salesLevel == 'diy_level' ">
|
|
|
+ ORDER BY sort.company_sort+0 asc
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
</mapper>
|