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.
84 lines
3.4 KiB
84 lines
3.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.GuideDao">
|
|
|
|
<resultMap type="com.epmet.entity.GuideEntity" id="guideMap">
|
|
<result property="id" column="ID"/>
|
|
<result property="customerId" column="CUSTOMER_ID"/>
|
|
<result property="orgType" column="ORG_TYPE"/>
|
|
<result property="orgId" column="ORG_ID"/>
|
|
<result property="pid" column="PID"/>
|
|
<result property="pids" column="PIDS"/>
|
|
<result property="title" column="TITLE"/>
|
|
<result property="categoryCode" column="CATEGORY_CODE"/>
|
|
<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="getGuideList" resultType="com.epmet.dto.result.GuideListResultDTO">
|
|
SELECT
|
|
g.ID AS "guideId",
|
|
g.TITLE AS "title",
|
|
gc.CATEGORY_NAME AS "categoryName",
|
|
g.CREATED_BY AS "createdId",
|
|
g.UPDATED_TIME AS "updatedTime",
|
|
if(exists( select gr.id from guide_reader gr
|
|
where gr.del_flag='0'
|
|
and gr.GUIDE_ID=g.id
|
|
and gr.USER_ID = #{userId}),1,0) AS readFlag
|
|
FROM
|
|
guide g
|
|
INNER JOIN guide_category gc ON g.CATEGORY_CODE = gc.CATEGORY_CODE AND gc.DEL_FLAG = 0 AND gc.CUSTOMER_ID = #{customerId}
|
|
WHERE g.DEL_FLAG = 0
|
|
AND g.CUSTOMER_ID = #{customerId}
|
|
<if test='null != agencyId and "" != agencyId'>
|
|
AND g.PIDS LIKE CONCAT( '%', #{agencyId}, '%' )
|
|
</if>
|
|
<if test='null != guideTitle and "" != guideTitle'>
|
|
AND g.TITLE LIKE CONCAT( '%', #{guideTitle}, '%' )
|
|
</if>
|
|
<if test='null != categoryCode and "" != categoryCode'>
|
|
AND g.CATEGORY_CODE = #{categoryCode}
|
|
</if>
|
|
ORDER BY g.CREATED_TIME DESC
|
|
</select>
|
|
<select id="getGuideDetail" resultType="com.epmet.dto.result.GuideDetailResultDTO">
|
|
SELECT
|
|
g.ID AS "guideId",
|
|
g.ORG_TYPE,
|
|
g.ORG_ID,
|
|
g.ORG_NAME,
|
|
g.TITLE,
|
|
g.CATEGORY_CODE,
|
|
gc.CATEGORY_NAME
|
|
FROM
|
|
guide g
|
|
INNER JOIN guide_category gc ON g.CATEGORY_CODE = gc.CATEGORY_CODE AND gc.CUSTOMER_ID = #{customerId}
|
|
WHERE
|
|
g.ID = #{guideId}
|
|
and g.DEL_FLAG = '0'
|
|
and gc.DEL_FLAG = '0'
|
|
</select>
|
|
<select id="getCollectionList" resultType="com.epmet.dto.result.GuideListResultDTO">
|
|
SELECT
|
|
g.ID AS "guideId",
|
|
g.TITLE AS "title",
|
|
gc.CATEGORY_NAME AS categoryName,
|
|
g.CREATED_BY AS createdId,
|
|
g.UPDATED_TIME AS updatedTime
|
|
FROM
|
|
guide g
|
|
INNER JOIN guide_category gc ON g.CATEGORY_CODE = gc.CATEGORY_CODE AND gc.DEL_FLAG = 0 AND gc.CUSTOMER_ID = #{customerId}
|
|
INNER JOIN guide_collection gco ON g.ID = gco.GUIDE_ID AND gco.USER_ID = #{userId} AND gco.APP = #{app} AND gco.DEL_FLAG = 0
|
|
WHERE g.DEL_FLAG = 0
|
|
AND g.CUSTOMER_ID = #{customerId}
|
|
ORDER BY gco.CREATED_TIME DESC
|
|
</select>
|
|
|
|
|
|
</mapper>
|
|
|