Browse Source

联建活动查询test1

master
yinzuomei 3 years ago
parent
commit
86d1de24e7
  1. 8
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java
  2. 79
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyActivityDao.xml

8
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java

@ -102,14 +102,14 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
@Override @Override
public PageData<IcPartyActivityDTO> search(PartyActivityFormDTO formDTO) { public PageData<IcPartyActivityDTO> search(PartyActivityFormDTO formDTO) {
if (null == formDTO.getStartTime()) { /*if (null == formDTO.getStartTime()) {
Date startDate = DateUtils.parse("1900-01-01 00:00:00", DateUtils.DATE_TIME_PATTERN); Date startDate = DateUtils.parse("1900-01-01 00:00:00", DateUtils.DATE_TIME_PATTERN);
formDTO.setStartTime(startDate); formDTO.setStartTime(startDate);
} }
if (null == formDTO.getEndTime()) { if (null == formDTO.getEndTime()) {
Date endDate = DateUtils.parse("2099-12-31 00:00:00", DateUtils.DATE_TIME_PATTERN); Date endDate = DateUtils.parse("2099-12-31 00:00:00", DateUtils.DATE_TIME_PATTERN);
formDTO.setEndTime(endDate); formDTO.setEndTime(endDate);
} }*/
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize());
List<IcPartyActivityEntity> list = baseDao.selectActivityList(formDTO); List<IcPartyActivityEntity> list = baseDao.selectActivityList(formDTO);
PageInfo<IcPartyActivityEntity> pageInfo = new PageInfo<>(list); PageInfo<IcPartyActivityEntity> pageInfo = new PageInfo<>(list);
@ -159,14 +159,14 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
@Override @Override
public List<IcPartyActivityDTO> list(PartyActivityFormDTO formDTO) { public List<IcPartyActivityDTO> list(PartyActivityFormDTO formDTO) {
if (null == formDTO.getStartTime()) { /*if (null == formDTO.getStartTime()) {
Date startDate = DateUtils.parse("1900-01-01 00:00:00", DateUtils.DATE_TIME_PATTERN); Date startDate = DateUtils.parse("1900-01-01 00:00:00", DateUtils.DATE_TIME_PATTERN);
formDTO.setStartTime(startDate); formDTO.setStartTime(startDate);
} }
if (null == formDTO.getEndTime()) { if (null == formDTO.getEndTime()) {
Date endDate = DateUtils.parse("2099-12-31 00:00:00", DateUtils.DATE_TIME_PATTERN); Date endDate = DateUtils.parse("2099-12-31 00:00:00", DateUtils.DATE_TIME_PATTERN);
formDTO.setEndTime(endDate); formDTO.setEndTime(endDate);
} }*/
List<IcPartyActivityEntity> list = baseDao.selectActivityList(formDTO); List<IcPartyActivityEntity> list = baseDao.selectActivityList(formDTO);
List<IcPartyActivityDTO> dtoList = ConvertUtils.sourceToTarget(list, IcPartyActivityDTO.class); List<IcPartyActivityDTO> dtoList = ConvertUtils.sourceToTarget(list, IcPartyActivityDTO.class);

79
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyActivityDao.xml

@ -51,69 +51,52 @@
a.ID, a.ID,
a.ACT_ID, a.ACT_ID,
a.GRID_ID, a.GRID_ID,
b.unitId, ur.UNIT_ID,
c.serviceMatter, GROUP_CONCAT( sr.SERVICE_MATTER ) AS serviceMatter,
TITLE, a.TITLE,
TARGET, a.TARGET,
CONTENT, a.CONTENT,
PEOPLE_COUNT, a.PEOPLE_COUNT,
ACTIVITY_TIME, a.ACTIVITY_TIME,
ADDRESS, a.ADDRESS,
LONGITUDE, a.LONGITUDE,
LATITUDE, a.LATITUDE,
RESULT, a.RESULT,
a.AGENCY_ID, a.AGENCY_ID,
a.CUSTOMER_ID a.CUSTOMER_ID
FROM FROM
ic_party_activity a ic_party_activity a
INNER JOIN ( left join ic_activity_unit_relation ur
SELECT on (ur.ACTIVITY_ID=a.id
ur.ACTIVITY_ID, and ur.del_flag='0')
GROUP_CONCAT( ur.UNIT_ID ) AS unitId left JOIN ic_activity_service_relation sr
FROM on(a.ID = sr.ACTIVITY_ID
ic_activity_unit_relation ur and sr.del_flag='0')
WHERE WHERE
ur.DEL_FLAG = '0' a.DEL_FLAG = '0'
<if test='null != agencyId and "" != agencyId'> <if test='null != agencyId and "" != agencyId'>
AND (ur.AGENCY_ID = #{agencyId} or ur.PIDS like concat('%',#{agencyId},'%')) AND (a.AGENCY_ID = #{agencyId} or a.PIDS like concat('%',#{agencyId},'%'))
</if>
<if test='null != gridId and "" != gridId'>
AND a.GRID_ID = #{gridId}
</if>
<if test='null != title and "" != title'>
AND a.TITLE LIKE concat('%', #{title}, '%')
</if> </if>
<if test='null != unitId and "" != unitId'> <if test='null != unitId and "" != unitId'>
AND ur.UNIT_ID = #{unitId} AND ur.UNIT_ID = #{unitId}
</if> </if>
GROUP BY
ur.ACTIVITY_ID
) b ON a.ID = b.ACTIVITY_ID
INNER JOIN (
SELECT
sr.ACTIVITY_ID,
GROUP_CONCAT( sr.SERVICE_MATTER ) AS serviceMatter
FROM
ic_activity_service_relation sr
WHERE
sr.DEL_FLAG = '0'
<if test='null != agencyId and "" != agencyId'>
AND (sr.AGENCY_ID = #{agencyId} or sr.PIDS like concat('%',#{agencyId},'%'))
</if>
<if test='null != serviceMatter and "" != serviceMatter'> <if test='null != serviceMatter and "" != serviceMatter'>
AND sr.SERVICE_MATTER = #{serviceMatter} AND sr.SERVICE_MATTER = #{serviceMatter}
</if> </if>
GROUP BY <if test=" null != startTime and startTime != '' ">
sr.ACTIVITY_ID AND a.ACTIVITY_TIME <![CDATA[ >= ]]> #{startTime}
) c ON a.ID = c.ACTIVITY_ID
WHERE
a.DEL_FLAG = '0'
<if test='null != agencyId and "" != agencyId'>
AND (a.AGENCY_ID = #{agencyId} or a.PIDS like concat('%',#{agencyId},'%'))
</if>
<if test='null != gridId and "" != gridId'>
AND a.GRID_ID = #{gridId}
</if> </if>
<if test='null != title and "" != title'> <if test="null != endTime and endTime != '' ">
AND TITLE LIKE concat('%', #{title}, '%') AND a.ACTIVITY_TIME <![CDATA[ <= ]]> #{endTime}
</if> </if>
AND ACTIVITY_TIME BETWEEN #{startTime} AND #{endTime} GROUP BY a.id
ORDER BY ACTIVITY_TIME DESC ORDER BY a.ACTIVITY_TIME DESC
</select> </select>
<select id="getActivityList" resultType="com.epmet.entity.IcPartyActivityEntity" parameterType = "com.epmet.dto.form.PartyActivityFormDTO"> <select id="getActivityList" resultType="com.epmet.entity.IcPartyActivityEntity" parameterType = "com.epmet.dto.form.PartyActivityFormDTO">

Loading…
Cancel
Save