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.
 
 
 
 
 

129 lines
5.4 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.HomeComponentDao">
<resultMap type="com.epmet.entity.HomeComponentEntity" id="homeComponentMap">
<result property="id" column="ID"/>
<result property="functionId" column="FUNCTION_ID"/>
<result property="componentName" column="COMPONENT_NAME"/>
<result property="componentFrontId" column="COMPONENT_FRONT_ID"/>
<result property="clientType" column="CLIENT_TYPE"/>
<result property="conponentType" column="CONPONENT_TYPE"/>
<result property="region" column="REGION"/>
<result property="configuration" column="CONFIGURATION"/>
<result property="configurationDescription" column="CONFIGURATION_DESCRIPTION"/>
<result property="demoData" column="DEMO_DATA"/>
<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>
<!-- 通用组件列表查询 -->
<select id="selectListCommonComponentResultDTO" parameterType="com.epmet.dto.form.ComponentListByCustomerFormDTO"
resultType="com.epmet.dto.result.CommonComponentResultDTO">
SELECT
hc.id AS component_id,
hc.COMPONENT_NAME,
hc.COMPONENT_FRONT_ID,
hc.CONFIGURATION,
hc.DEMO_DATA,
hc.CONFIGURATION_DESCRIPTION,
hc.REGION
FROM
home_component hc
WHERE
hc.DEL_FLAG = '0'
AND hc.CONPONENT_TYPE = '0'
<if test='clientType != "" and clientType != null'>
AND hc.CLIENT_TYPE = #{clientType}
</if>
ORDER BY
CONVERT ( hc.COMPONENT_NAME USING gbk ) ASC
</select>
<resultMap id="FunctionComponentResultDTOMap" type="com.epmet.dto.result.FunctionComponentResultDTO">
<result column="FUNCTION_ID" jdbcType="VARCHAR" property="functionId" />
<result column="FUNCTION_NAME" jdbcType="VARCHAR" property="functionName" />
<!--一对多,方式一-->
<collection property="componentList"
column="{functionId=FUNCTION_ID,customerId=customerId,clientType=clientType}"
ofType="com.epmet.dto.form.ComponentListByCustomerFormDTO"
javaType="ArrayList"
select="com.epmet.dao.HomeComponentDao.selectComponentList" />
</resultMap>
<!-- 功能组件列表查询 -->
<select id="selectListFunctionComponentResultDTO" parameterType="com.epmet.dto.form.ComponentListByCustomerFormDTO"
resultMap="FunctionComponentResultDTOMap">
SELECT
cf.FUNCTION_ID,
f.FUNCTION_NAME,
case when ('${customerId}' != '') then '${customerId}' else '' end as customerId,
case when ('${clientType}' != '') then '${clientType}' else '' end as clientType
FROM
customer_function cf
LEFT JOIN `FUNCTION` f ON ( cf.FUNCTION_ID = f.id )
WHERE
cf.DEL_FLAG = '0'
AND f.SHOPPING_STATUS='1'
AND f.DEL_FLAG = '0'
AND CF.CUSTOMER_ID=#{customerId}
ORDER BY
CONVERT ( F.FUNCTION_NAME USING gbk ) ASC
</select>
<!-- 功能件列表查询(子sql)-->
<select id="selectComponentList" resultType="com.epmet.dto.result.CommonComponentResultDTO"
parameterType="com.epmet.dto.form.ComponentListByCustomerFormDTO">
SELECT
hc.id AS component_id,
hc.COMPONENT_NAME,
hc.COMPONENT_FRONT_ID,
hc.CONFIGURATION,
hc.DEMO_DATA,
hc.CONFIGURATION_DESCRIPTION,
hc.REGION
FROM
home_component hc
WHERE
hc.DEL_FLAG = '0'
AND hc.CONPONENT_TYPE = '1'
<if test='clientType != "" and clientType != null'>
AND hc.CLIENT_TYPE = #{clientType}
</if>
<if test='functionId != "" and functionId != null'>
and hc.FUNCTION_ID=#{functionId}
</if>
ORDER BY
CONVERT ( hc.COMPONENT_NAME USING gbk ) ASC
</select>
<!-- 分页查询组件信息 -->
<select id="selectListHomeComponentDTO" parameterType="map" resultType="com.epmet.dto.HomeComponentDTO">
select hc.*,f.FUNCTION_NAME
from home_component hc
left join function f on(hc.FUNCTION_ID=f.id and f.del_flag='0')
where hc.del_flag='0'
<if test='componentName != "" and componentName != null'>
AND hc.COMPONENT_NAME LIKE concat('%', trim(#{componentName}), '%')
</if>
<if test='clientType != "" and clientType != null'>
AND hc.CLIENT_TYPE = #{clientType}
</if>
<if test='conponentType != "" and conponentType != null'>
AND hc.CONPONENT_TYPE = #{conponentType}
</if>
<if test='region != "" and region != null'>
AND hc.REGION = #{region}
</if>
<if test='functionId != "" and functionId != null'>
AND hc.FUNCTION_ID = #{functionId}
</if>
order by hc.CREATED_TIME desc
</select>
</mapper>