Browse Source

cascadegencyinfo,级联查出下级机关信息

dev_shibei_match
wangchao 5 years ago
parent
commit
270d59862c
  1. 41
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/AgencySubTreeDto.java
  2. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  3. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java
  4. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsDemoService.java
  5. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDemoServiceImpl.java
  6. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/DemoGovOrgService.java
  7. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/DemoGovOrgServiceImpl.java
  8. 51
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml

41
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/AgencySubTreeDto.java

@ -0,0 +1,41 @@
package com.epmet.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Description
* @ClassName AgencySubTreeDto
* @Auth wangc
* @Date 2020-06-16 16:51
*/
@Data
public class AgencySubTreeDto implements Serializable {
private static final long serialVersionUID = 312765293830315198L;
/**
* 机构Id
* */
private String agencyId;
/**
* 机构名称
* */
private String agencyName;
/**
* 直属网格Id
* */
List<String> gridIds;
/**
* 客户Id
* */
String customerId;
/**
* 下级机关集合
* */
List<AgencySubTreeDto> subAgencies;
}

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java

@ -1,11 +1,14 @@
package com.epmet.controller;
import com.epmet.dto.AgencySubTreeDto;
import com.epmet.service.StatsDemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RequestMapping("demo")
@RestController
public class DemoController {
@ -23,5 +26,11 @@ public class DemoController {
demoService.testTx();
}
@GetMapping("cascadegencyinfo")
public List<AgencySubTreeDto> selectAllAgency(){
List<AgencySubTreeDto> result = demoService.getAllAgency();
return result;
}
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java

@ -1,8 +1,10 @@
package com.epmet.dao.org;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.AgencySubTreeDto;
import com.epmet.entity.org.CustomerAgencyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -11,4 +13,7 @@ public interface StatsCustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
List<CustomerAgencyEntity> listAllEntities();
List<AgencySubTreeDto> selectAllAgency();
List<AgencySubTreeDto> selectSubAgencyByPid(@Param("pid")String pid);
}

6
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsDemoService.java

@ -1,8 +1,12 @@
package com.epmet.service;
import com.epmet.dto.AgencySubTreeDto;
import java.util.List;
public interface StatsDemoService {
void testList();
void testTx();
List<AgencySubTreeDto> getAllAgency();
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDemoServiceImpl.java

@ -1,5 +1,6 @@
package com.epmet.service.impl;
import com.epmet.dto.AgencySubTreeDto;
import com.epmet.entity.issue.IssueEntity;
import com.epmet.entity.org.CustomerAgencyEntity;
import com.epmet.service.Issue.DemoIssueService;
@ -37,4 +38,8 @@ public class StatsDemoServiceImpl implements StatsDemoService {
public void testTx() {
demoDataStatsService.testTx();
}
public List<AgencySubTreeDto> getAllAgency(){
return demoGovOrgService.getAllAgency();
}
}

3
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/DemoGovOrgService.java

@ -1,9 +1,12 @@
package com.epmet.service.org;
import com.epmet.dto.AgencySubTreeDto;
import com.epmet.entity.org.CustomerAgencyEntity;
import java.util.List;
public interface DemoGovOrgService {
List<CustomerAgencyEntity> listAllEntities();
List<AgencySubTreeDto> getAllAgency();
}

6
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/DemoGovOrgServiceImpl.java

@ -3,6 +3,7 @@ package com.epmet.service.org.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.org.StatsCustomerAgencyDao;
import com.epmet.dto.AgencySubTreeDto;
import com.epmet.entity.org.CustomerAgencyEntity;
import com.epmet.service.org.DemoGovOrgService;
import org.springframework.beans.factory.annotation.Autowired;
@ -20,4 +21,9 @@ public class DemoGovOrgServiceImpl implements DemoGovOrgService {
public List<CustomerAgencyEntity> listAllEntities() {
return govOrgDao.listAllEntities();
}
@Override
public List<AgencySubTreeDto> getAllAgency() {
return govOrgDao.selectAllAgency();
}
}

51
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml

@ -10,4 +10,55 @@
<select id="listAllEntities" resultType="com.epmet.entity.org.CustomerAgencyEntity">
select * from customer_agency
</select>
<resultMap id="treeMap" type="com.epmet.dto.AgencySubTreeDto">
<id column="agencyId" property="agencyId" />
<result column="agencyName" property="agencyName"/>
<result column="customer_Id" property="customerId" />
<collection property="gridIds" ofType="java.lang.String">
<constructor>
<arg column="gridId"/>
</constructor>
</collection>
<collection property="subAgencies" column="agencyId"
ofType="com.epmet.dto.AgencySubTreeDto" select="selectSubAgencyByPid"></collection>
</resultMap>
<select id="selectAllAgency" resultMap="treeMap">
SELECT
agency.ID AS agencyId,
agency.ORGANIZATION_NAME AS agencyName,
grid.ID AS gridId,
agency.CUSTOMER_ID
FROM
customer_agency agency
LEFT JOIN customer_grid grid ON agency.ID = grid.PID
AND grid.DEL_FLAG = '0'
WHERE
agency.DEL_FLAG = '0'
ORDER BY
agency.CUSTOMER_ID,
agency.PID
</select>
<select id="selectSubAgencyByPid" resultMap="treeMap" parameterType="string">
SELECT
agency.id AS agencyId,
agency.ORGANIZATION_NAME AS agencyName,-- agency.PID,agency.PIDS ,
grid.ID AS gridId, -- ,GRID_NAME
agency.CUSTOMER_ID
FROM
customer_agency agency
LEFT JOIN customer_grid grid ON agency.ID = grid.PID
AND grid.DEL_FLAG = '0'
WHERE
agency.DEL_FLAG = '0'
AND agency.PID = #{pid}
ORDER BY
agency.CUSTOMER_ID,
agency.ID,
grid.ID
</select>
</mapper>
Loading…
Cancel
Save