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.

164 lines
6.2 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.FunctionCustomizedDao">
<!-- 定制功能详情查询 -->
<select id="getFunctionCustomizedByFunctionId" parameterType="com.epmet.dto.form.CommonFunctionIdFormDTO"
resultType="com.epmet.dto.result.FunctionCustomizedDetailResultDTO">
SELECT
cu.FUNCTION_ID functionId,
f.SHOPPING_STATUS shoppingStatus,
f.FUNCTION_EXPLAIN functionExplain,
cu.CUSTOMIZED_NAME functionName,
cu.ICON_LARGE_IMG iconLargeImg,
cu.ICON_SMALL_IMG iconSmallImg,
cu.TARGET_LINK targetLink,
cu.DOMAIN_NAME domainName,
cu.FROM_APP fromApp
FROM function_customized cu
LEFT JOIN `function` f ON cu.FUNCTION_ID = f.ID
WHERE cu.DEL_FLAG = '0'
AND cu.FUNCTION_ID = #{functionId}
</select>
<update id="delByFunctionId" parameterType="String">
update function_customized set DEL_FLAG = 1 where FUNCTION_ID = #{functionId} and DEL_FLAG = '0'
</update>
<!-- 根据功能id,查询定制功能全部信息(定制功能表+功能表) -->
<select id="selectCustomized" parameterType="String"
resultType="com.epmet.dto.CustomizedDTO">
SELECT
f.ID functionId,
f.SHOPPING_STATUS shoppingStatus,
f.FUNCTION_EXPLAIN functionExplain,
cu.ID customizedId,
cu.CUSTOMIZED_NAME customizedName,
cu.ICON_LARGE_IMG iconLargeImg,
cu.ICON_SMALL_IMG iconSmallImg,
cu.TARGET_LINK targetLink,
cu.DOMAIN_NAME domainName,
cu.FROM_APP fromApp
FROM `function` f
LEFT JOIN function_customized cu ON f.ID = cu.FUNCTION_ID
WHERE f.DEL_FLAG = '0'
AND f.ID = #{functionId}
</select>
<!-- 定制功能列表 -->
<select id="selectListFunctionCustomizedList" parameterType="com.epmet.dto.form.FunctionCustomizedListFormDTO"
resultType="com.epmet.dto.result.FunctionCustomizedListDTO">
SELECT
f.ID functionId,
f.SHOPPING_STATUS shoppingStatus,
f.FUNCTION_EXPLAIN functionExplain,
cu.CUSTOMIZED_NAME customizedName,
cu.ICON_LARGE_IMG iconLargeImg,
cu.ICON_SMALL_IMG iconSmallImg,
cu.TARGET_LINK targetLink,
cu.DOMAIN_NAME domainName,
cu.FROM_APP fromApp
FROM `function` f
LEFT JOIN function_customized cu ON f.ID = cu.FUNCTION_ID
WHERE f.DEL_FLAG = '0'
AND cu.DEL_FLAG = '0'
<if test="customizedName != null and customizedName.trim() != ''">
AND cu.CUSTOMIZED_NAME like concat('%', #{customizedName}, '%')
</if>
<if test="fromApp != null and fromApp.trim() != ''">
AND cu.FROM_APP = #{fromApp}
</if>
ORDER BY cu.FROM_APP, f.CREATED_TIME DESC
</select>
<!-- 定制功能列表 总条数 -->
<select id="countTotalFunctionCustomizedList" parameterType="com.epmet.dto.form.FunctionCustomizedListFormDTO"
resultType="INT">
SELECT
count(1)
FROM `function` f
LEFT JOIN function_customized cu ON f.ID = cu.FUNCTION_ID
WHERE f.DEL_FLAG = '0'
AND cu.DEL_FLAG = '0'
<if test="customizedName != null and customizedName.trim() != ''">
AND cu.CUSTOMIZED_NAME like concat('%', #{customizedName}, '%')
</if>
<if test="fromApp != null and fromApp.trim() != ''">
AND cu.FROM_APP = #{fromApp}
</if>
</select>
<select id="selectDomains" resultType="com.epmet.dto.FunctionCustomizedDTO">
SELECT
cfd.DOMAIN_NAME,
fc.FROM_APP
FROM
customer_function_detail cfd
INNER JOIN function_customized fc ON cfd.FUNCTION_ID = fc.FUNCTION_ID
WHERE
cfd.DEL_FLAG = 0
AND fc.DEL_FLAG = 0
AND cfd.SHOPPING_STATUS = 1
AND cfd.CUSTOMER_ID = #{customerId}
</select>
<select id="selectFunctionCustomizedList" resultType="com.epmet.dto.result.FunctionResultDTO">
SELECT
fc.FUNCTION_ID AS "functionId",
fc.CUSTOMIZED_NAME AS "customizedName",
fc.FROM_APP AS "fromApp",
f.FUNCTION_EXPLAIN AS "functionExplain"
FROM
function_customized fc
INNER JOIN `function` f ON fc.FUNCTION_ID = f.ID
WHERE
fc.DEL_FLAG = '0'
AND f.DEL_FLAG = '0'
AND f.shopping_status = '1' <!-- 只查询客户上架状态的 -->
<foreach collection="functionIds" item="functionId" index="index" open="AND ( " separator=" AND " close=")">
fc.FUNCTION_ID != #{functionId}
</foreach>
</select>
<select id="selectByFunctionId" resultType="com.epmet.dto.FunctionCustomizedDTO">
SELECT
function_id,
customized_name,
icon_large_img,
icon_small_img,
domain_name,
target_link
FROM
function_customized
WHERE
del_flag = '0'
AND function_id = #{functionId}
</select>
<update id="updateFunctionCustomized" parameterType="com.epmet.entity.FunctionCustomizedEntity">
UPDATE function_customized
SET
<if test="customizedName != null and customizedName.trim() != ''">
CUSTOMIZED_NAME = #{customizedName},
</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>
<if test="targetLink != null and targetLink.trim() != ''">
TARGET_LINK = #{targetLink},
</if>
<if test="domainName != null and domainName.trim() != ''">
DOMAIN_NAME = #{domainName},
</if>
<if test="fromApp != null and fromApp.trim() != ''">
FROM_APP = #{fromApp},
</if>
UPDATED_TIME = now()
WHERE
DEL_FLAG = '0'
AND FUNCTION_ID = #{functionId}
</update>
</mapper>