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.
156 lines
5.7 KiB
156 lines
5.7 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.CustomerFunctionDetailDao">
|
|
|
|
<!-- 根据functionId查询使用该功能的,客户id -->
|
|
<select id="selectCustomerIdByFunctionId" parameterType="String"
|
|
resultType="com.epmet.dto.CustomerFunctionDetailDTO">
|
|
SELECT
|
|
ID id,
|
|
CUSTOMER_ID customerId,
|
|
FUNCTION_ID functionId,
|
|
FUNCTION_NAME functionName,
|
|
ICON_LARGE_IMG iconLargeImg,
|
|
ICON_SMALL_IMG iconSmallImg,
|
|
DOMAIN_NAME domainName,
|
|
TARGET_LINK targetLink,
|
|
DISPLAY_ORDER displayOrder
|
|
FROM customer_function_detail
|
|
WHERE DEL_FLAG = '0'
|
|
AND FUNCTION_ID = #{functionId}
|
|
</select>
|
|
|
|
<select id="selectFunctionDetailList" resultType="com.epmet.dto.result.FunctionDetailResultDTO">
|
|
SELECT
|
|
cfd.function_id AS "functionId",
|
|
cfd.function_name AS "functionName",
|
|
cfd.icon_large_img AS "iconLargeImg",
|
|
cfd.icon_small_img AS "iconSmallImg",
|
|
CONCAT(
|
|
cfd.domain_name,
|
|
cfd.target_link
|
|
) AS "url",
|
|
cfd.display_order AS "dispalyOrder"
|
|
FROM
|
|
customer_function_detail cfd
|
|
INNER JOIN `function` f ON cfd.function_id = f.id
|
|
INNER JOIN function_customized fc ON cfd.function_id = fc.function_id
|
|
WHERE
|
|
cfd.del_flag = '0'
|
|
AND f.del_flag = '0'
|
|
AND fc.del_flag = '0'
|
|
AND f.function_group = '1' <!-- 功能类型:0.默认功能,1.定制功能 -->
|
|
AND f.shopping_status = '1' <!-- 上架状态:0:下架、1:上架 -->
|
|
AND cfd.customer_id = #{customerId}
|
|
AND fc.from_app = #{clientType}
|
|
ORDER BY
|
|
cfd.display_order ASC
|
|
</select>
|
|
|
|
<select id="selectCustomerFunction" resultType="com.epmet.dto.result.CustomerResultDTO">
|
|
SELECT
|
|
cfd.customer_id AS "customerId",
|
|
cfd.function_id AS "functionId",
|
|
cfd.function_name AS "functionName",
|
|
cfd.icon_large_img AS "iconLargeImg",
|
|
cfd.icon_small_img AS "iconSmallImg",
|
|
cfd.shopping_status AS "shoppingStatus",
|
|
cfd.domain_name AS "domainName",
|
|
cfd.target_link AS "targetLink",
|
|
cfd.display_order AS "displayOrder",
|
|
fc.customized_name AS "customizedName",
|
|
fc.from_app AS "fromApp",
|
|
fc.icon_large_img AS "defaultLargeImg",
|
|
fc.icon_small_img AS "defaultSmallImg",
|
|
f.function_explain AS "functionExplain"
|
|
FROM
|
|
customer_function_detail cfd
|
|
INNER JOIN function_customized fc ON cfd.function_id = fc.function_id
|
|
INNER JOIN `function` f ON cfd.function_id = f.id
|
|
WHERE
|
|
cfd.del_flag = '0'
|
|
AND fc.del_flag = '0'
|
|
AND f.del_flag = '0'
|
|
AND cfd.customer_id = #{customerId}
|
|
ORDER BY
|
|
cfd.DISPLAY_ORDER ASC
|
|
</select>
|
|
|
|
<select id="selectOrderByCustomerId" resultType="com.epmet.dto.CustomerFunctionDetailDTO">
|
|
SELECT
|
|
customer_id,
|
|
function_id,
|
|
function_name,
|
|
icon_large_img,
|
|
icon_small_img,
|
|
domain_name,
|
|
target_link,
|
|
shopping_status,
|
|
IFNULL(display_order, 0) AS displayOrder
|
|
FROM
|
|
customer_function_detail
|
|
WHERE
|
|
del_flag = '0'
|
|
AND customer_id = #{customerId}
|
|
ORDER BY display_order DESC
|
|
LIMIT 1
|
|
</select>
|
|
|
|
<update id="updateShoppingStatus" parameterType="com.epmet.dto.form.UpdateShoppingStatusFormDTO">
|
|
UPDATE customer_function_detail
|
|
SET
|
|
SHOPPING_STATUS = #{shoppingStatus},
|
|
UPDATED_BY = #{userId},
|
|
UPDATED_TIME = now()
|
|
WHERE
|
|
DEL_FLAG = '0'
|
|
AND CUSTOMER_ID = #{customerId}
|
|
AND FUNCTION_ID = #{functionId}
|
|
</update>
|
|
|
|
<update id="updateCustomerFunction" parameterType="com.epmet.dto.form.UpdateCustomerFunctionFormDTO">
|
|
UPDATE customer_function_detail
|
|
SET
|
|
<if test="functionName != null and functionName.trim() != ''">
|
|
FUNCTION_NAME = #{functionName},
|
|
</if>
|
|
<if test="iconLargeImg != null and iconLargeImg.trim() != ''">
|
|
ICON_LARGE_IMG = #{iconLargeImg},
|
|
</if>
|
|
<if test="iconSmallImg != null and iconSmallImg.trim() != ''">
|
|
ICON_SMALL_IMG = #{iconSmallImg},
|
|
</if>
|
|
UPDATED_BY = #{userId},
|
|
UPDATED_TIME = now()
|
|
WHERE
|
|
DEL_FLAG = '0'
|
|
AND CUSTOMER_ID = #{customerId}
|
|
AND FUNCTION_ID = #{functionId}
|
|
</update>
|
|
|
|
<update id="updateFunctionDetailList">
|
|
UPDATE customer_function_detail
|
|
<trim prefix="set" suffixOverrides=",">
|
|
|
|
<trim prefix="display_order =(case" suffix="end),">
|
|
<foreach collection="list" item="item">
|
|
when customer_id = #{item.customerId} and function_id = #{item.functionId} then #{item.displayOrder}
|
|
</foreach>
|
|
</trim>
|
|
|
|
<trim prefix="updated_by =(case" suffix="end),">
|
|
<foreach collection="list" item="item">
|
|
when customer_id = #{item.customerId} and function_id = #{item.functionId} then #{item.updatedBy}
|
|
</foreach>
|
|
</trim>
|
|
|
|
updated_time = now()
|
|
</trim>
|
|
WHERE
|
|
del_flag = '0'
|
|
<foreach collection="list" item="item" open="AND( " separator=" OR " index="index" close=")">
|
|
(customer_id = #{item.customerId} and function_id = #{item.functionId})
|
|
</foreach>
|
|
</update>
|
|
</mapper>
|
|
|