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.
 
 
 
 
 

536 lines
24 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.PARENT_CODE as parentCode,
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(sa.remark,'') as finishDesc,
'' AS serviceShowName,
s.id as serviceId,
(
case when r.PARENT_CODE !='0' then r.PARENT_CODE
ELSE R.CATEGORY_CODE
END
) as firstCategoryCode,
(
CASE WHEN R.DEMAND_USER_TYPE='ic_resi_user' THEN R.DEMAND_USER_ID
ELSE ''
END
) as icResiUserId,
(
CASE WHEN R.DEMAND_USER_TYPE='mini_resi' THEN R.DEMAND_USER_ID
ELSE ''
END
) as epmetUserId
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} or r.CATEGORY_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 != reportStartTime and reportStartTime != '' ">
AND DATE_FORMAT(r.REPORT_TIME,'%Y-%m-%d') <![CDATA[ >= ]]> #{reportStartTime}
</if>
<if test="null != reportEndTime and reportEndTime != '' ">
AND DATE_FORMAT(r.REPORT_TIME,'%Y-%m-%d') <![CDATA[ <= ]]> #{reportEndTime}
</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 != wantServiceStartTime and wantServiceStartTime != '' ">
AND DATE_FORMAT(r.WANT_SERVICE_TIME,'%Y-%m-%d') <![CDATA[ >= ]]> #{wantServiceStartTime}
</if>
<if test="null != wantServiceEndTime and wantServiceEndTime != '' ">
AND DATE_FORMAT(r.WANT_SERVICE_TIME,'%Y-%m-%d') <![CDATA[ <= ]]> #{wantServiceEndTime}
</if>
order by r.WANT_SERVICE_TIME desc,r.CREATED_TIME asc
</select>
<select id="selectUserDemand" parameterType="com.epmet.dto.form.demand.IcResiUserDemandFromDTO" resultType="com.epmet.dto.result.demand.IcResiUserReportDemandRes">
SELECT
r.id as demandRecId,
r.CATEGORY_CODE as categoryCode,
r.PARENT_CODE as parentCode,
r.CONTENT,
r.`STATUS`,
r.WANT_SERVICE_TIME as wantServiceTime,
left(r.CATEGORY_CODE,4) as firstCategoryCode
FROM
ic_user_demand_rec r
WHERE
r.DEL_FLAG = '0'
AND r.DEMAND_USER_ID in
<foreach item="demandUserId" collection="userIds" open="(" separator="," close=")">
#{demandUserId}
</foreach>
<if test="null !=firstCategoryCode and firstCategoryCode!=''">
and r.CATEGORY_CODE like concat(#{firstCategoryCode},'%')
</if>
<if test="null !=demandRecId and demandRecId!=''">
and r.id !=#{demandRecId}
</if>
ORDER BY
r.WANT_SERVICE_TIME DESC
</select>
<select id="selectDemandRecDetail" parameterType="java.lang.String" 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.PARENT_CODE as parentCode,
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(sa.remark,'') as finishDesc,
'' AS serviceShowName,
s.id as serviceId,
left(r.CATEGORY_CODE,4) as firstCategoryCode,
(
CASE WHEN R.DEMAND_USER_TYPE='ic_resi_user' THEN R.DEMAND_USER_ID
ELSE ''
END
) as icResiUserId,
(
CASE WHEN R.DEMAND_USER_TYPE='mini_resi' THEN R.DEMAND_USER_ID
ELSE ''
END
) as epmetUserId,
r.AWARD_POINT as awardPoint,
concat( r.SERVICE_LOCATION, r.LOCATION_DETAIL ) AS serviceAddress,
r.SERVICE_LOCATION,
r.LOCATION_DETAIL,
r.LONGITUDE,
r.LATITUDE
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}
and r.id=#{demandRecId}
</select>
<!-- 列表查询 -->
<select id="pageListAnalysis" parameterType="com.epmet.dto.form.demand.PageListAnalysisFormDTO" 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.PARENT_CODE as parentCode,
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(sa.remark,'') as finishDesc,
'' AS serviceShowName,
s.id as serviceId,
(
case when r.PARENT_CODE !='0' then r.PARENT_CODE
ELSE R.CATEGORY_CODE
END
) as firstCategoryCode,
(
CASE WHEN R.DEMAND_USER_TYPE='ic_resi_user' THEN R.DEMAND_USER_ID
ELSE ''
END
) as icResiUserId,
(
CASE WHEN R.DEMAND_USER_TYPE='mini_resi' THEN R.DEMAND_USER_ID
ELSE ''
END
) as epmetUserId
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 != orgType and orgType == 'grid' ">
and r.GRID_ID=#{orgId}
</if>
<if test="null != orgType and orgType == 'agency' ">
AND r.GRID_PIDS LIKE concat(#{gridPids},'%')
</if>
<if test="null != categoryCode and categoryCode !='' ">
and r.CATEGORY_CODE LIKE CONCAT(#{categoryCode},'%')
</if>
<if test=" null != startDateId and startDateId != '' ">
AND DATE_FORMAT(r.REPORT_TIME,'%Y-%m-%d') <![CDATA[ >= ]]> #{startDateId}
</if>
<if test="null != endDateId and endDateId != '' ">
AND DATE_FORMAT(r.REPORT_TIME,'%Y-%m-%d') <![CDATA[ <= ]]> #{endDateId}
</if>
<if test="null != excludeStatus and excludeStatus !='' ">
and r.STATUS !=#{excludeStatus}
</if>
order by r.WANT_SERVICE_TIME desc,r.REPORT_TIME asc
</select>
<resultMap id="CategoryAnalysisDTOMap" type="com.epmet.dto.result.demand.CategoryAnalysisDTO">
<result property="categoryCode" column="category_code"/>
<result property="categoryName" column="category_name"/>
<result property="total" column="TOTAL"/>
<collection property="detail" ofType="com.epmet.dto.result.demand.CategoryAnalysisDetail"
column="{categoryCode=category_code, orgType=org_type,orgId=org_id,gridPids=grid_pids,customerId=customer_id,startDateId=start_date_id,endDateId=end_date_id}"
select="com.epmet.dao.IcUserDemandRecDao.selectDetail">
</collection>
</resultMap>
<select id="selectListCategoryAnalysisDTO" parameterType="map" resultMap="CategoryAnalysisDTOMap">
<foreach collection="firstCategoryList" item="category" separator=" UNION ALL ">
select
#{category.value} as category_code,
#{category.label} as category_name,
count(m.id) as TOTAL,
#{orgType} as org_type,
#{orgId} as org_id,
#{gridPids} as grid_pids,
#{customerId} as customer_id,
#{startDateId} as start_date_id,
#{endDateId} as end_date_id
from ic_user_demand_rec m
where m.DEL_FLAG='0'
and m.CUSTOMER_ID=#{customerId}
<if test="null != orgType and orgType == 'grid' ">
and m.GRID_ID=#{orgId}
</if>
<if test="null != orgType and orgType == 'agency' ">
and m.GRID_PIDS like concat(#{gridPids},'%')
</if>
and DATE_FORMAT(m.REPORT_TIME,'%Y-%m-%d') &gt;= #{startDateId}
and DATE_FORMAT(m.REPORT_TIME,'%Y-%m-%d') &lt;= #{endDateId}
and m.CATEGORY_CODE like concat(#{category.value},'%')
and m.status !='canceled'
</foreach>
</select>
<select id="selectDetail" parameterType="map" resultType="com.epmet.dto.result.demand.CategoryAnalysisDetail">
select
#{categoryCode} as categoryCode,
s.SERVICE_TYPE as legendCode,
(
case when s.SERVICE_TYPE='volunteer' then '志愿者'
when s.SERVICE_TYPE='social_org' then '社会组织'
when s.SERVICE_TYPE='community_org' then '社区自组织'
when s.SERVICE_TYPE='party_unit' then '区域化党建单位'
end
)as legendName,
count(s.DEMAND_REC_ID) as serviceDemandTotal,
count(distinct s.SERVER_ID) as totalService
from ic_user_demand_service s
inner join ic_user_demand_rec m
on(s.DEMAND_REC_ID=m.ID)
where s.DEL_FLAG='0'
and m.DEL_FLAG='0'
and m.`STATUS`='finished'
and m.CUSTOMER_ID=#{customerId}
<if test="null != orgType and orgType == 'grid' ">
and m.GRID_ID=#{orgId}
</if>
<if test="null != orgType and orgType == 'agency' ">
and m.GRID_PIDS like concat(#{gridPids},'%')
</if>
and DATE_FORMAT(m.REPORT_TIME,'%Y-%m-%d') &gt;= #{startDateId}
and DATE_FORMAT(m.REPORT_TIME,'%Y-%m-%d') &lt;= #{endDateId}
and m.CATEGORY_CODE like concat(#{categoryCode},'%')
group by s.SERVICE_TYPE
union all
select
#{categoryCode} as categoryCode,
'unfinished' as legendCode,
'未完成' as legendName,
count(m.id) as serviceDemandTotal,
'0' as totalService
from ic_user_demand_rec m
where m.DEL_FLAG='0'
and m.`STATUS`!='finished'
and m.STATUS !='canceled'
and m.CUSTOMER_ID=#{customerId}
<if test="null != orgType and orgType == 'grid' ">
and m.GRID_ID=#{orgId}
</if>
<if test="null != orgType and orgType == 'agency' ">
and m.GRID_PIDS like concat(#{gridPids},'%')
</if>
and DATE_FORMAT(m.REPORT_TIME,'%Y-%m-%d') &gt;= #{startDateId}
and DATE_FORMAT(m.REPORT_TIME,'%Y-%m-%d') &lt;= #{endDateId}
and m.CATEGORY_CODE like concat(#{categoryCode},'%')
</select>
<!-- 服务评价后 ,计算服务方(区域化党建单位、社会组织、社区自组织)群众满意度 -->
<select id="selectGroupByServer" parameterType="map" resultType="com.epmet.dto.result.demand.ServiceStatDTO">
SELECT
S.SERVER_ID AS serverId,
SUM( M.SCORE ) AS totalScore,
count( DISTINCT m.DEMAND_REC_ID ) AS demandCount
FROM
ic_user_demand_satisfaction m
INNER JOIN ic_user_demand_rec r ON ( m.DEMAND_REC_ID = r.id )
INNER JOIN ic_user_demand_service s ON ( R.ID = s.DEMAND_REC_ID )
WHERE
m.DEL_FLAG = '0'
AND r.DEL_FLAG = '0'
AND m.CUSTOMER_ID = #{customerId}
AND r.`STATUS` = 'finished'
and s.SERVICE_TYPE=#{serviceType}
<if test="null !=serverId and serverId!='' ">
and s.server_id=#{serverId}
</if>
group by s.SERVER_ID
</select>
<!-- 居民端-需求大厅(未处理、处理中、已完成) type 未处理:unprocessed;处理中:processing;已完成:finished -->
<!-- 未处理:未指派、未接单;处理中:已指派、已接单给我的 ;已完成:我填写实际服务时间,并点击确认 -->
<select id="selectListDemandHall" parameterType="map" resultType="com.epmet.dto.result.demand.DemandHallResultDTO">
SELECT
r.id as demandRecId,
r.CATEGORY_CODE,
r.PARENT_CODE,
r.WANT_SERVICE_TIME,
concat( r.SERVICE_LOCATION, r.LOCATION_DETAIL ) AS serviceAddress,
r.AWARD_POINT,
r.DEMAND_USER_NAME,
r.DEMAND_USER_MOBILE,
s.SCORE,
r.`STATUS`,
r.EVALUATE_FLAG
FROM
ic_user_demand_rec r
left join ic_user_demand_service m
on(r.id=m.DEMAND_REC_ID and m.DEL_FLAG='0')
LEFT JOIN ic_user_demand_satisfaction s ON ( r.id = s.DEMAND_REC_ID AND s.DEL_FLAG = '0' )
WHERE
r.DEL_FLAG = '0'
AND r.GRID_ID = #{gridId}
AND R.DEMAND_USER_ID !=#{currentUserId}
<if test="null !=type and type =='unprocessed' ">
AND r.`STATUS` = 'pending'
</if>
<if test="null !=type and type =='processing' ">
AND (r.`STATUS` = 'assigned' OR r.`STATUS` = 'have_order')
and m.SERVER_ID=#{currentUserId}
</if>
<if test="null !=type and type =='finished' ">
AND r.`STATUS`='finished'
and m.SERVER_ID=#{currentUserId}
and m.SERVICE_START_TIME is not null and m.SERVICE_END_TIME is not null
</if>
order by r.WANT_SERVICE_TIME asc
</select>
<!-- 居民端-我的需求(待处理,处理中,已完成,已取消) -->
<!-- type 待处理:unprocessed;处理中:processing;已完成:finished;已取消:canceled -->
<select id="queryMyDemandForResiClient" parameterType="map" resultType="com.epmet.dto.result.demand.ResiClientMyDemandResDTO">
SELECT
r.id as demandRecId,
r.CATEGORY_CODE,
r.PARENT_CODE,
r.WANT_SERVICE_TIME,
concat( r.SERVICE_LOCATION, r.LOCATION_DETAIL ) AS serviceAddress,
m.SERVICE_TYPE,
m.SERVER_ID,
r.EVALUATE_FLAG,
s.SCORE,
r.`STATUS`,
r.CANCEL_TIME
FROM
ic_user_demand_rec r
left join ic_user_demand_service m
on(r.id=m.DEMAND_REC_ID and m.DEL_FLAG='0')
LEFT JOIN ic_user_demand_satisfaction s ON ( r.id = s.DEMAND_REC_ID AND s.DEL_FLAG = '0' )
WHERE
r.DEL_FLAG = '0'
AND r.GRID_ID = #{gridId}
AND R.DEMAND_USER_ID =#{demandUserId}
<if test="null !=type and type =='unprocessed' ">
AND r.`STATUS` = 'pending'
</if>
<if test="null !=type and type =='processing' ">
AND (r.`STATUS` = 'assigned' OR r.`STATUS` = 'have_order')
</if>
<if test="null !=type and type =='finished' ">
AND r.`STATUS` = 'finished'
</if>
<if test="null !=type and type =='canceled' ">
AND r.`STATUS` = 'canceled'
</if>
order by r.WANT_SERVICE_TIME asc
</select>
<select id="selectNoEvaluate" resultType="com.epmet.dto.IcUserDemandRecDTO">
SELECT
r.*,
s.SERVER_ID,
s.SERVICE_TYPE
FROM
ic_user_demand_rec r
INNER JOIN ic_user_demand_service s ON ( r.id = s.demand_rec_id )
WHERE
r.DEL_FLAG = '0'
AND r.`STATUS` = 'finished'
AND r.EVALUATE_FLAG = '0'
and s.SERVICE_START_TIME is not NULL
and s.SERVICE_END_TIME is not null
<if test="null !=type and type =='day' ">
and timestampdiff(day,s.UPDATED_TIME,now()) &gt; #{exceedValue}
</if>
<if test="null !=type and type =='minute' ">
and timestampdiff(MINUTE,s.UPDATED_TIME,now()) &gt; #{exceedValue}
</if>
<if test="null !=customerId and customerId !='' ">
AND r.customer_id =#{customerId}
</if>
</select>
<!-- 更新主表为已评价, 是否解决 -->
<update id="evaluate" parameterType="map">
update ic_user_demand_rec
set EVALUATE_FLAG='1',
FINISH_RESULT=#{finishResult},
UPDATED_TIME=NOW()
where id=#{demandRecId}
</update>
</mapper>