springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/ComAreaTownCommunityApi.java
New file @@ -0,0 +1,38 @@ package com.panzhihua.community_backstage.api; import com.panzhihua.common.controller.BaseController; import com.panzhihua.common.model.dtos.property.CommonPage; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.acid.ComAreaCounty; import com.panzhihua.common.service.community.CommunityService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.io.Serializable; import java.util.List; /** * (ComAreaTownCommunity)表控制层 * projectName 成都呐喊信息技术有限公司-智慧社区项目 * description: 相关功能 * * @author zzj * @since 2022-04-10 17:37:33 */ @Api(tags = {"区县联动列表"}) @RestController @RequestMapping("comAreaTownCommunity") public class ComAreaTownCommunityApi extends BaseController { @Resource private CommunityService communityService; @ApiOperation(value = "列表查询",response = ComAreaCounty.class) @GetMapping("/areaTownCommunity") public R test(){ return communityService.areaTownCommunity(this.getLoginUserInfo().getName()); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComAreaTownCommunityApi.java
New file @@ -0,0 +1,119 @@ package com.panzhihua.service_community.api; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.dtos.property.CommonPage; import com.panzhihua.service_community.dao.ComAreaTownCommunityDao; import com.panzhihua.common.model.vos.community.acid.ComAreaCounty; import com.panzhihua.service_community.entity.ComAreaTownCommunity; import com.panzhihua.service_community.service.ComAreaTownCommunityService; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.io.Serializable; import java.util.List; /** * (ComAreaTownCommunity)表控制层 * projectName 成都呐喊信息技术有限公司-智慧社区项目 * description: 相关功能 * * @author zzj * @since 2022-04-10 17:37:33 */ @RestController @RequestMapping("comAreaTownCommunity") public class ComAreaTownCommunityApi { /** * 服务对象 */ @Resource private ComAreaTownCommunityService comAreaTownCommunityService; @Resource private ComAreaTownCommunityDao comAreaTownCommunityDao; /** * 分页查询所有数据 * * @param commonPage 查询实体 * @return 所有数据 */ @PostMapping("queryAll") public R selectAll(@RequestBody CommonPage commonPage) { return this.comAreaTownCommunityService.pageList(commonPage); } /** * 通过主键查询单条数据 * * @param id 主键 * @return 单条数据 */ @GetMapping("{id}") public R selectOne(@PathVariable("id") Serializable id) { return R.ok(this.comAreaTownCommunityService.getById(id)); } /** * 新增数据 * * @param comAreaTownCommunity 实体对象 * @return 新增结果 */ @PostMapping public R insert(@RequestBody ComAreaTownCommunity comAreaTownCommunity) { return R.ok(this.comAreaTownCommunityService.save(comAreaTownCommunity)); } /** * 修改数据 * * @param comAreaTownCommunity 实体对象 * @return 修改结果 */ @PostMapping("/update") public R update(@RequestBody ComAreaTownCommunity comAreaTownCommunity) { return R.ok(this.comAreaTownCommunityService.updateById(comAreaTownCommunity)); } /** * 删除数据 * * @param id 主键结合 * @return 删除结果 */ @GetMapping("del") public R delete(@RequestParam("id") Long id) { return R.ok(this.comAreaTownCommunityService.removeById(id)); } @GetMapping("/areaTownCommunity") public R test(@RequestParam("name")String name){ if("panzhihua".equals(name)){ List<ComAreaCounty> list=comAreaTownCommunityDao.selectArea(); list.forEach(lis->{ List<ComAreaCounty> townList=comAreaTownCommunityDao.selectTown(lis.getValue()); townList.forEach(tow->{ tow.setChildren(comAreaTownCommunityDao.selectCommunity(tow.getValue())); }); lis.setChildren(townList); }); return R.ok(list); } else { List<ComAreaCounty> townList=comAreaTownCommunityDao.selectTown(name); if(!CollectionUtils.isEmpty(townList)){ townList.forEach(tow->{ tow.setChildren(comAreaTownCommunityDao.selectCommunity(tow.getValue())); }); return R.ok(townList); } else { List<ComAreaCounty> list=comAreaTownCommunityDao.selectCommunity(name); return R.ok(list); } } } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComAreaTownCommunityDao.java
New file @@ -0,0 +1,23 @@ package com.panzhihua.service_community.dao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.panzhihua.common.model.vos.community.acid.ComAreaCounty; import org.apache.ibatis.annotations.Mapper; import com.panzhihua.service_community.entity.ComAreaTownCommunity; import java.util.List; /** * (ComAreaTownCommunity)表数据库访问层 * projectName 成都呐喊信息技术有限公司-智慧社区项目 * description: 相关功能 * * @author zzj * @since 2022-04-10 17:37:32 */ @Mapper public interface ComAreaTownCommunityDao extends BaseMapper<ComAreaTownCommunity> { List<ComAreaCounty> selectArea(); List<ComAreaCounty> selectTown(String area); List<ComAreaCounty> selectCommunity(String town); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComAreaTownCommunityService.java
New file @@ -0,0 +1,24 @@ package com.panzhihua.service_community.service; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.dtos.property.CommonPage; import com.baomidou.mybatisplus.extension.service.IService; import com.panzhihua.service_community.entity.ComAreaTownCommunity; /** * (ComAreaTownCommunity)表服务接口 * projectName 成都呐喊信息技术有限公司-智慧社区项目 * description: 相关功能 * * @author zzj * @since 2022-04-10 17:37:33 */ public interface ComAreaTownCommunityService extends IService<ComAreaTownCommunity> { /** * 分页查询 * * @param commonPage * @return */ R pageList(CommonPage commonPage); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComAreaTownCommunityServiceImpl.java
New file @@ -0,0 +1,75 @@ package com.panzhihua.service_community.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.panzhihua.common.model.dtos.property.CommonPage; import com.panzhihua.common.model.vos.R; import com.panzhihua.service_community.entity.ComAreaTownCommunity; import com.panzhihua.service_community.dao.ComAreaTownCommunityDao; import com.panzhihua.service_community.service.ComAreaTownCommunityService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ArrayUtils; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.Arrays; import java.util.Random; import java.util.stream.Collectors; /** * (ComAreaTownCommunity)表服务实现类 * projectName 成都呐喊信息技术有限公司-智慧社区项目 * description: 相关功能 * * @author zzj * @since 2022-04-10 17:37:33 */ @Slf4j @Service public class ComAreaTownCommunityServiceImpl extends ServiceImpl<ComAreaTownCommunityDao, ComAreaTownCommunity> implements ComAreaTownCommunityService { @Override public R pageList(CommonPage commonPage) { return null; } private Integer[] A={6,7,8,9,10,11}; private Integer[] B={12,13,14,15,16,17,18,19,20,21,22}; private Integer[] C={23,24,25,26,27,28,29,30,31,32,33}; private Integer[] D={10,11,12,13,14}; public void test(){ Random random=new Random(); Integer a=random.nextInt(A.length); Integer a_f=A[a]; Integer b=random.nextInt(B.length); Integer b_f=B[b]; Integer[] B1=ArrayUtils.remove(B,b); Integer c=random.nextInt(B1.length); Integer c_f=B1[c]; Integer d=random.nextInt(C.length); Integer d_f=C[d]; Integer[] c1=ArrayUtils.remove(C,d); Integer e=random.nextInt(c1.length); Integer e_f=c1[e]; Integer[] c2=ArrayUtils.remove(c1,e); Integer f=random.nextInt(c2.length); Integer f_f=c2[f]; Integer g=random.nextInt(D.length); Integer g_f=D[g]; Integer[] fi={a_f,+b_f,c_f,d_f,+e_f,f_f}; Arrays.sort(fi); Integer[] ffi=ArrayUtils.add(fi,g_f); System.out.println(Arrays.toString(ffi)); } public static void main(String[] args) { System.out.println("今日开奖预测:"); for (int i=0;i<5;i++){ ComAreaTownCommunityServiceImpl communityService=new ComAreaTownCommunityServiceImpl(); communityService.test(); } } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComAreaTownCommunityMapper.xml
New file @@ -0,0 +1,25 @@ <?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.panzhihua.service_community.dao.ComAreaTownCommunityDao"> <resultMap type="com.panzhihua.service_community.entity.ComAreaTownCommunity" id="ComAreaTownCommunityBaseResultMap"> <result property="id" column="id"/> <result property="area" column="area"/> <result property="town" column="town"/> <result property="community" column="community"/> </resultMap> <select id="selectArea" resultType="com.panzhihua.common.model.vos.community.acid.ComAreaCounty"> select distinct area as value from com_area_town_community </select> <select id="selectTown" resultType="com.panzhihua.common.model.vos.community.acid.ComAreaCounty"> select distinct town as value from com_area_town_community where area =#{area} </select> <select id="selectCommunity" resultType="com.panzhihua.common.model.vos.community.acid.ComAreaCounty"> select distinct community as value from com_area_town_community where town =#{town} </select> </mapper>