Browse Source

add 城市列表

he2802 4 years ago
parent
commit
432e5494a6

+ 15 - 2
zhongzheng-admin/src/main/java/com/zhongzheng/controller/base/ApplyAreasController.java

@@ -6,6 +6,7 @@ import java.util.Arrays;
 import com.zhongzheng.modules.base.bo.ApplyAreasAddBo;
 import com.zhongzheng.modules.base.bo.ApplyAreasEditBo;
 import com.zhongzheng.modules.base.bo.ApplyAreasQueryBo;
+import com.zhongzheng.modules.base.domain.ApplyAreas;
 import com.zhongzheng.modules.base.service.IApplyAreasService;
 import com.zhongzheng.modules.base.vo.ApplyAreasVo;
 import lombok.RequiredArgsConstructor;
@@ -43,9 +44,9 @@ public class ApplyAreasController extends BaseController {
     private final IApplyAreasService iApplyAreasService;
 
     /**
-     * 查询报考地区列表
+     * 查询报考地区列表
      */
-    @ApiOperation("查询报考地区列表")
+    @ApiOperation("查询报考地区列表")
     @PreAuthorize("@ss.hasPermi('system:areas:list')")
     @GetMapping("/list")
     public TableDataInfo<ApplyAreasVo> list(ApplyAreasQueryBo bo) {
@@ -54,6 +55,18 @@ public class ApplyAreasController extends BaseController {
         return getDataTable(list);
     }
 
+    /**
+     * 查询报考市地区列表
+     */
+    @ApiOperation("查询报考市地区列表")
+    @PreAuthorize("@ss.hasPermi('system:areas:city_list')")
+    @GetMapping("/cityList")
+    public TableDataInfo<ApplyAreas> cityList(ApplyAreasQueryBo bo) {
+        startPage();
+        List<ApplyAreas> list = iApplyAreasService.selectCityList(bo);
+        return getDataTable(list);
+    }
+
     /**
      * 导出报考地区列表
      */

+ 2 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/bo/ApplyAreasQueryBo.java

@@ -6,6 +6,7 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 
 import java.util.Date;
+import java.util.List;
 import java.util.Map;
 import java.util.HashMap;
 
@@ -53,5 +54,5 @@ public class ApplyAreasQueryBo extends BaseEntity {
 	private Long areaType;
 	/**  状态 1正常 0关闭 */
 	@ApiModelProperty(" 状态 1正常 0关闭")
-	private Integer status;
+	private List<Integer> status;
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/domain/ApplyAreas.java

@@ -44,4 +44,6 @@ private static final long serialVersionUID=1L;
     /** 更新时间 */
     @TableField(fill = FieldFill.INSERT_UPDATE)
     private Long updateTime;
+    /** 父名称 */
+    private String parentName;
 }

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/mapper/ApplyAreasMapper.java

@@ -1,7 +1,11 @@
 package com.zhongzheng.modules.base.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zhongzheng.modules.base.bo.ApplyAreasQueryBo;
 import com.zhongzheng.modules.base.domain.ApplyAreas;
+import com.zhongzheng.modules.base.vo.ApplyAreasVo;
+
+import java.util.List;
 
 /**
  * 报考地区Mapper接口
@@ -11,4 +15,6 @@ import com.zhongzheng.modules.base.domain.ApplyAreas;
  */
 public interface ApplyAreasMapper extends BaseMapper<ApplyAreas> {
 
+    List<ApplyAreas> selectCityList(ApplyAreasQueryBo bo);
+
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/IApplyAreasService.java

@@ -29,6 +29,8 @@ public interface IApplyAreasService extends IService<ApplyAreas> {
 	 */
 	List<ApplyAreasVo> queryList(ApplyAreasQueryBo bo);
 
+	List<ApplyAreas> selectCityList(ApplyAreasQueryBo bo);
+
 	/**
 	 * 根据新增业务对象插入报考地区
 	 * @param bo 报考地区新增业务对象

+ 11 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/ApplyAreasServiceImpl.java

@@ -11,6 +11,7 @@ import com.zhongzheng.modules.base.domain.ApplyAreas;
 import com.zhongzheng.modules.base.mapper.ApplyAreasMapper;
 import com.zhongzheng.modules.base.service.IApplyAreasService;
 import com.zhongzheng.modules.base.vo.ApplyAreasVo;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -19,7 +20,6 @@ import com.github.pagehelper.Page;
 
 
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -32,6 +32,10 @@ import java.util.stream.Collectors;
 @Service
 public class ApplyAreasServiceImpl extends ServiceImpl<ApplyAreasMapper, ApplyAreas> implements IApplyAreasService {
 
+
+    @Autowired
+    private ApplyAreasMapper applyAreasMapper;
+
     @Override
     public ApplyAreasVo queryById(Long areaId){
         ApplyAreas db = this.baseMapper.selectById(areaId);
@@ -46,10 +50,15 @@ public class ApplyAreasServiceImpl extends ServiceImpl<ApplyAreasMapper, ApplyAr
         lqw.like(StrUtil.isNotBlank(bo.getAreaFullName()), ApplyAreas::getAreaFullName, bo.getAreaFullName());
         lqw.eq(bo.getParentId() != null, ApplyAreas::getParentId, bo.getParentId());
         lqw.eq(bo.getAreaType() != null, ApplyAreas::getAreaType, bo.getAreaType());
-        lqw.eq(bo.getStatus() != null, ApplyAreas::getStatus, bo.getStatus());
+        lqw.in(bo.getStatus() != null, ApplyAreas::getStatus, bo.getStatus());
         return entity2Vo(this.list(lqw));
     }
 
+    @Override
+    public List<ApplyAreas> selectCityList(ApplyAreasQueryBo bo) {
+        return applyAreasMapper.selectCityList(bo);
+    }
+
     /**
     * 实体类转化成视图对象
     *

+ 19 - 0
zhongzheng-system/src/main/resources/mapper/modules/base/ApplyAreasMapper.xml

@@ -14,7 +14,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="status" column="status"/>
         <result property="createTime" column="create_time"/>
         <result property="updateTime" column="update_time"/>
+        <result property="parentName" column="parent_name"/>
     </resultMap>
 
+    <select id="selectCityList" parameterType="com.zhongzheng.modules.base.bo.ApplyAreasQueryBo"  resultMap="ApplyAreasResult">
+        SELECT
+        a1.*,
+        a2.area_name AS parent_name
+        FROM
+        apply_areas a1
+        LEFT JOIN apply_areas a2 ON a1.parent_id = a2.area_id
+        WHERE 1=1
+        <if test="status != null and status.size()!=0 ">
+            AND cs.status in
+            <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="areaName != null and areaName != ''">
+            AND cs.area_name like concat('%', #{areaName}, '%')
+        </if>
+    </select>
 
 </mapper>