Browse Source

获取居民需求选项

dev_shibei_match
zhaoqifeng 4 years ago
parent
commit
1a5837eb97
  1. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiDemandDictController.java
  2. 5
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiDemandDictDao.java
  3. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiDemandDictService.java
  4. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiDemandDictServiceImpl.java
  5. 39
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiDemandDictDao.xml

9
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiDemandDictController.java

@ -17,7 +17,10 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
@ -29,6 +32,7 @@ import com.epmet.service.IcResiDemandDictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@ -81,4 +85,9 @@ public class IcResiDemandDictController {
return new Result();
}
@PostMapping("demandoption")
public Result<List<OptionResultDTO>> getDemandOptions(@LoginUser TokenDto tokenDto) {
return new Result<List<OptionResultDTO>>().ok(icResiDemandDictService.getDemandOptions(tokenDto.getCustomerId()));
}
}

5
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiDemandDictDao.java

@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.entity.IcResiDemandDictEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -32,6 +33,6 @@ import java.util.List;
*/
@Mapper
public interface IcResiDemandDictDao extends BaseDao<IcResiDemandDictEntity> {
List<OptionResultDTO> selectDemandOptions(String customerId);
List<OptionResultDTO> selectChildDemands(String parentCode);
List<OptionResultDTO> selectDemandOptions(@Param("customerId") String customerId);
List<OptionResultDTO> selectChildDemands(@Param("customerId")String customerId, @Param("parentCode") String parentCode);
}

10
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiDemandDictService.java

@ -18,6 +18,7 @@
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IcResiDemandDictDTO;
import com.epmet.entity.IcResiDemandDictEntity;
@ -93,4 +94,13 @@ public interface IcResiDemandDictService extends BaseService<IcResiDemandDictEnt
*/
void delete(String[] ids);
/**
* @Description 获取居民需求
* @Param customerId
* @Return {@link List< OptionResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/27 17:57
*/
List<OptionResultDTO> getDemandOptions(String customerId);
}

14
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiDemandDictServiceImpl.java

@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.IcResiDemandDictDao;
@ -96,4 +97,17 @@ public class IcResiDemandDictServiceImpl extends BaseServiceImpl<IcResiDemandDic
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @param customerId
* @Description 获取居民需求
* @Param customerId
* @Return {@link List< OptionResultDTO >}
* @Author zhaoqifeng
* @Date 2021/10/27 17:57
*/
@Override
public List<OptionResultDTO> getDemandOptions(String customerId) {
return baseDao.selectDemandOptions(customerId);
}
}

39
epmet-user/epmet-user-server/src/main/resources/mapper/IcResiDemandDictDao.xml

@ -19,8 +19,43 @@
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="selectDemandOptions" resultType="com.epmet.commons.tools.dto.result.OptionResultDTO"> </select>
<select id="selectChildDemands" resultType="com.epmet.commons.tools.dto.result.OptionResultDTO"> </select>
<resultMap id="DemandResult" type="com.epmet.commons.tools.dto.result.OptionResultDTO">
<result column="customerId"/>
<result column="value" property="value"/>
<result column="label" property="label"/>
<collection property="children" ofType="com.epmet.commons.tools.dto.result.OptionResultDTO"
select="selectChildDemands" column="customerId=customerId,parentCode=value">
</collection>
</resultMap>
<select id="selectDemandOptions" resultMap="DemandResult">
SELECT
CUSTOMER_ID AS customerId,
CATEGORY_CODE AS "value",
CATEGORY_NAME AS "label"
FROM
ic_resi_demand_dict
WHERE
DEL_FLAG = 0
AND LEVEL = 1
AND CUSTOMER_ID = #{customerId}
ORDER BY
SORT ASC
</select>
<select id="selectChildDemands" resultMap="DemandResult">
SELECT
CUSTOMER_ID AS customerId,
CATEGORY_CODE AS "value",
CATEGORY_NAME AS "label"
FROM
ic_resi_demand_dict
WHERE
DEL_FLAG = 0
AND LEVEL = 2
AND CUSTOMER_ID = #{customerId}
AND PARENT_CODE = #{parentCode}
ORDER BY
SORT ASC
</select>
</mapper>
Loading…
Cancel
Save