|
@@ -17,10 +17,12 @@ 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" />
|
|
|
</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 from alert_configuration
|
|
|
</sql>
|
|
|
|
|
|
<select id="selectAlertConfigurationList" parameterType="AlertConfiguration" resultMap="AlertConfigurationResult">
|
|
@@ -36,11 +38,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</where>
|
|
|
</select>
|
|
|
|
|
|
- <select id="selectAlertConfigurationListFilter" resultType="java.lang.Integer">
|
|
|
- SELECT
|
|
|
- count(0)
|
|
|
- FROM
|
|
|
- alert_configuration
|
|
|
+ <select id="selectAlertConfigurationListFilter" parameterType="Long" resultMap="AlertConfigurationResult">
|
|
|
+ <include refid="selectAlertConfigurationVo"/>
|
|
|
WHERE alert_status = 1
|
|
|
<if test="userType !=null and userType !=''">
|
|
|
and user_type = #{userType}
|
|
@@ -118,5 +117,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>
|