forked from zhangyuan/epmet-cloud-lingshan
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.
118 lines
6.1 KiB
118 lines
6.1 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.IcUserDemandRecDao">
|
|
|
|
<resultMap type="com.epmet.entity.IcUserDemandRecEntity" id="icUserDemandRecMap">
|
|
<result property="id" column="ID"/>
|
|
<result property="customerId" column="CUSTOMER_ID"/>
|
|
<result property="gridId" column="GRID_ID"/>
|
|
<result property="agencyId" column="AGENCY_ID"/>
|
|
<result property="gridPids" column="GRID_PIDS"/>
|
|
<result property="categoryCode" column="CATEGORY_CODE"/>
|
|
<result property="parentCode" column="PARENT_CODE"/>
|
|
<result property="content" column="CONTENT"/>
|
|
<result property="reportType" column="REPORT_TYPE"/>
|
|
<result property="reportUserName" column="REPORT_USER_NAME"/>
|
|
<result property="reportUserMobile" column="REPORT_USER_MOBILE"/>
|
|
<result property="reportUserId" column="REPORT_USER_ID"/>
|
|
<result property="reportTime" column="REPORT_TIME"/>
|
|
<result property="wantServiceTime" column="WANT_SERVICE_TIME"/>
|
|
<result property="demandUserType" column="DEMAND_USER_TYPE"/>
|
|
<result property="demandUserId" column="DEMAND_USER_ID"/>
|
|
<result property="demandUserName" column="DEMAND_USER_NAME"/>
|
|
<result property="demandUserMobile" column="DEMAND_USER_MOBILE"/>
|
|
<result property="status" column="STATUS"/>
|
|
<result property="finishResult" column="FINISH_RESULT"/>
|
|
<result property="cancelTime" column="CANCEL_TIME"/>
|
|
<result property="evaluateFlag" column="EVALUATE_FLAG"/>
|
|
<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="pageSelect" parameterType="com.epmet.dto.form.demand.UserDemandPageFormDTO" resultType="com.epmet.dto.result.demand.DemandRecResultDTO">
|
|
SELECT
|
|
r.ID as demandRecId,
|
|
r.GRID_ID as gridId,
|
|
r.agency_id as agencyId,
|
|
r.CATEGORY_CODE as categoryCode,
|
|
r.CONTENT,
|
|
r.REPORT_TYPE as reportType,
|
|
r.REPORT_TIME as reportTime,
|
|
r.REPORT_USER_NAME as reportUserName,
|
|
r.REPORT_USER_MOBILE as reportUserMobile,
|
|
r.`STATUS` as status,
|
|
r.DEMAND_USER_ID as demandUserId,
|
|
r.DEMAND_USER_NAME as demandUserName,
|
|
r.DEMAND_USER_MOBILE as demandUserMobile,
|
|
concat(r.DEMAND_USER_NAME,'(',r.DEMAND_USER_MOBILE,')') as demandUser,
|
|
r.WANT_SERVICE_TIME as wantServiceTime,
|
|
IFNULL(r.FINISH_RESULT,'') as finishResult,
|
|
r.CANCEL_TIME as cancelTime,
|
|
r.EVALUATE_FLAG as evaluateFlag,
|
|
IFNULL(sa.SCORE,0) as score,
|
|
IFNULL( s.SERVICE_TYPE, '' ) AS serviceType,
|
|
IFNULL( s.SERVER_ID, '' ) AS serverId,
|
|
(
|
|
CASE WHEN s.SERVICE_TYPE='social_org' then (select m1.SOCIETY_NAME as socialOrgName from ic_society_org m1 where m1.id=s.SERVER_ID)
|
|
WHEN s.SERVICE_TYPE='community_org' then (select m2.ORGANIZATION_NAME as communityName from ic_community_self_organization m2 where m2.id=s.SERVER_ID)
|
|
WHEN s.SERVICE_TYPE='party_unit' then (select m3.UNIT_NAME as partyUnitName from ic_party_unit m3 where m3.id=s.SERVER_ID)
|
|
else ''
|
|
end
|
|
) as serviceName,
|
|
s.SERVICE_START_TIME as serviceStartTime,
|
|
s.SERVICE_END_TIME as serviceEndTime,
|
|
IFNULL(s.FINISH_DESC,'') as finishDesc,
|
|
'' AS serviceShowName,
|
|
s.id as serviceId
|
|
FROM
|
|
ic_user_demand_rec r
|
|
left JOIN ic_user_demand_service s ON ( r.id = s.DEMAND_REC_ID AND s.DEL_FLAG = '0' )
|
|
left join ic_user_demand_satisfaction sa on(r.id=sa.DEMAND_REC_ID AND sa.DEL_FLAG = '0')
|
|
WHERE
|
|
r.DEL_FLAG = '0'
|
|
AND r.CUSTOMER_ID = #{customerId}
|
|
<if test="null != gridId and gridId != '' ">
|
|
and r.GRID_ID=#{gridId}
|
|
</if>
|
|
<if test="null == gridId or gridId == '' ">
|
|
AND r.GRID_PIDS LIKE concat('%',#{gridPids},'%')
|
|
</if>
|
|
<if test="null != level and level ==1">
|
|
and r.PARENT_CODE=#{categoryCode}
|
|
</if>
|
|
<if test="null != level and level ==2">
|
|
and r.CATEGORY_CODE=#{categoryCode}
|
|
</if>
|
|
<if test="null != demandUserName and demandUserName !='' ">
|
|
and r.DEMAND_USER_NAME like concat('%',#{demandUserName},'%')
|
|
</if>
|
|
<if test=" null != reportStartDate and reportStartDate != '' ">
|
|
AND DATE_FORMAT(r.REPORT_TIME,'%Y-%m-%d') <![CDATA[ >= ]]> #{reportStartDate}
|
|
</if>
|
|
<if test="null != reportEndDate and reportEndDate != '' ">
|
|
AND DATE_FORMAT(r.REPORT_TIME,'%Y-%m-%d') <![CDATA[ <= ]]> #{reportEndDate}
|
|
</if>
|
|
<if test="null != status and status != '' ">
|
|
and r.STATUS=#{status}
|
|
</if>
|
|
<if test="null != serviceType and serviceType != '' ">
|
|
and s.SERVICE_TYPE=#{serviceType}
|
|
</if>
|
|
<if test="null != serverId and serverId != '' ">
|
|
and s.SERVER_ID=#{serverId}
|
|
</if>
|
|
<if test=" null != wantServiceStartDate and wantServiceStartDate != '' ">
|
|
AND DATE_FORMAT(r.WANT_SERVICE_TIME,'%Y-%m-%d') <![CDATA[ >= ]]> #{wantServiceStartDate}
|
|
</if>
|
|
<if test="null != wantServiceEndDate and wantServiceEndDate != '' ">
|
|
AND DATE_FORMAT(r.WANT_SERVICE_TIME,'%Y-%m-%d') <![CDATA[ <= ]]> #{wantServiceEndDate}
|
|
</if>
|
|
order by r.WANT_SERVICE_TIME desc,r.CREATED_TIME asc
|
|
</select>
|
|
</mapper>
|