You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

290 lines
9.0 KiB

<?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.epmet.dao.CustomerFootBarDao">
<resultMap type="com.epmet.entity.CustomerFootBarEntity" id="customerFootBarMap">
<result property="id" column="ID"/>
<result property="barName" column="BAR_NAME"/>
<result property="barKey" column="BAR_KEY"/>
<result property="appType" column="APP_TYPE"/>
<result property="pageTitle" column="PAGE_TITLE"/>
<result property="iconPath" column="ICON_PATH"/>
<result property="selectedIconPath" column="SELECTED_ICON_PATH"/>
<result property="orderIndex" column="ORDER_INDEX"/>
<result property="display" column="DISPLAY"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<!--更新顺序号-->
<update id="updateOrder">
update customer_foot_bar
set ORDER_INDEX = #{orderIndex}
where ID = #{id}
and DEL_FLAG='0'
</update>
<update id="updateDisplayStatus">
update customer_foot_bar
set DISPLAY=#{display}
where ID = #{id}
and DEL_FLAG='0'
</update>
<!--物理删除-->
<delete id="physicsDeleteById">
delete
from customer_foot_bar
where ID = #{id}
</delete>
<delete id="physicsDeleteByAppTypeAndBarKey">
delete
from customer_foot_bar
where app_type = #{appType}
and BAR_KEY = #{barKey}
and id=#{id}
</delete>
<!--查询客户的footbar列表-->
<select id="listDisplayCustomerFootBars" resultType="com.epmet.entity.CustomerFootBarEntity">
SELECT
id,
customer_id,
app_type,
bar_key,
bar_name,
page_title,
icon_path,
selected_icon_path,
display,
order_index,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time,
FLOAT_ICON_PATH
FROM
customer_foot_bar
<where>
DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
AND APP_TYPE = #{appType}
AND DISPLAY = 1
</where>
ORDER BY `ORDER_INDEX` ASC
</select>
<select id="listAllCustomerFootBars" resultType="com.epmet.entity.CustomerFootBarEntity">
SELECT
id,
customer_id,
app_type,
bar_key,
bar_name,
page_title,
icon_path,
selected_icon_path,
display,
order_index,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time,
FLOAT_ICON_PATH as floatIconPath
FROM
customer_foot_bar
<where>
DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
AND APP_TYPE = #{appType}
</where>
ORDER BY `ORDER_INDEX` ASC
</select>
<select id="count4Unique" resultType="java.lang.Integer">
select count(1)
from customer_foot_bar
<where>
<if test="appType != null and appType != ''">
app_type = #{appType}
</if>
<if test="barKey != null and barKey != ''">
and BAR_KEY = #{barKey}
</if>
<if test="customerId != null and customerId != ''">
and CUSTOMER_ID = #{customerId}
</if>
<if test="barName != null and barName != ''">
and BAR_NAME= #{barName}
</if>
and DEL_FLAG=0
</where>
</select>
<select id="fetchNextOrder" resultType="java.lang.Integer">
select ifnull(max(`ORDER_INDEX`),-1) + 1
from customer_foot_bar
<where>
app_type = #{appType}
and CUSTOMER_ID = #{customerId}
and DEL_FLAG=0
</where>
</select>
<select id="getByAppTypeAndBarKeyOfCustomer" resultType="com.epmet.entity.CustomerFootBarEntity">
select id,
customer_id,
app_type,
bar_key,
bar_name,
page_title,
icon_path,
selected_icon_path,
display,
order_index,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time,
FLOAT_ICON_PATH as floatIconPath
from customer_foot_bar
where CUSTOMER_ID = #{customerId}
and APP_TYPE = #{appType}
and BAR_KEY = #{barKey}
and DEL_FLAG='0'
</select>
<select id="listByAppTypeAndCustomerId" resultType="com.epmet.entity.CustomerFootBarEntity">
select id,
customer_id,
app_type,
bar_key,
bar_name,
page_title,
icon_path,
selected_icon_path,
FLOAT_ICON_PATH as floatIconPath,
display,
order_index,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time
from customer_foot_bar
where CUSTOMER_ID = #{customerId}
and app_type = #{appType}
and DEL_FLAG=0
</select>
<select id="listFootBarOwnerCustomerIds" resultType="java.lang.String">
select distinct CUSTOMER_ID
from customer_foot_bar fb
where CUSTOMER_ID != 'default'
and DEL_FLAG='0'
</select>
<select id="getByAppTypeAndBarNameOfCustomer" resultType="com.epmet.entity.CustomerFootBarEntity">
select id,
customer_id,
app_type,
bar_key,
bar_name,
page_title,
icon_path,
selected_icon_path,
FLOAT_ICON_PATH as floatIconPath,
display,
order_index,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time
from customer_foot_bar
where CUSTOMER_ID = #{customerId}
and APP_TYPE = #{appType}
and BAR_NAME = #{barName}
and DEL_FLAG='0'
</select>
<select id="selectNotOnlineFootBars" parameterType="map" resultType="com.epmet.entity.CustomerFootBarEntity">
select
m.BAR_NAME as barName,
m.BAR_KEY as barKey,
m.app_type as appType,
m.PAGE_TITLE as pageTitle,
m.ICON_PATH as iconPath,
m.SELECTED_ICON_PATH as selectedIconPath,
m.FLOAT_ICON_PATH as floatIconPath
from customer_foot_bar m
where m.DEL_FLAG='0'
and m.CUSTOMER_ID='default'
and m.app_type=#{appType}
and m.DISPLAY='1'
and m.BAR_KEY not in(
select cfb.BAR_KEY
from customer_foot_bar cfb
where cfb.DEL_FLAG='0'
and cfb.CUSTOMER_ID=#{customerId}
and cfb.app_type=#{appType}
)order by m.ORDER_INDEX asc
</select>
<!-- 根据key查询 -->
<select id="selectListByKey" parameterType="map" resultType="com.epmet.entity.CustomerFootBarEntity">
select
m.BAR_NAME as barName,
m.BAR_KEY as barKey,
m.app_type as appType,
m.PAGE_TITLE as pageTitle,
m.ICON_PATH as iconPath,
m.SELECTED_ICON_PATH as selectedIconPath,
m.FLOAT_ICON_PATH as floatIconPath
from customer_foot_bar m
where m.DEL_FLAG='0'
and m.CUSTOMER_ID=#{customerId}
and m.app_type=#{appType}
and m.DISPLAY='1'
and m.BAR_KEY in
<foreach collection="barKeyList" item="barKey" open="( " separator=" , " index="index" close=")">
#{barKey}
</foreach>
</select>
<update id="updateCustomerFootBarByKey" parameterType="map">
UPDATE customer_foot_bar
SET BAR_NAME = #{barName},
PAGE_TITLE = #{pageTitle},
ICON_PATH = #{iconPath},
SELECTED_ICON_PATH = #{selectedIconPath},
FLOAT_ICON_PATH = #{floatIconPath},
UPDATED_BY = #{userId},
UPDATED_TIME = NOW()
WHERE
CUSTOMER_ID = #{customerId}
AND app_type = #{appType}
AND BAR_KEY = #{barKey}
AND DEL_FLAG = '0'
</update>
<update id="updateFootBarDel" parameterType="map">
UPDATE customer_foot_bar
set DEL_FLAG='1',UPDATED_BY = #{userId}, UPDATED_TIME = NOW()
where id=#{id}
</update>
</mapper>