修正项目
This commit is contained in:
5
xlcs-parent/service/service-sys/Dockerfile
Normal file
5
xlcs-parent/service/service-sys/Dockerfile
Normal file
@@ -0,0 +1,5 @@
|
||||
FROM openjdk:8-jdk-alpine
|
||||
LABEL authors="yovinchen"
|
||||
VOLUME /tmp
|
||||
ADD ./target/service-sys.jar service-sys.jar
|
||||
ENTRYPOINT ["java","-jar","/service-sys.jar", "&"]
|
20
xlcs-parent/service/service-sys/pom.xml
Normal file
20
xlcs-parent/service/service-sys/pom.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.yovinchen</groupId>
|
||||
<artifactId>service</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>service-sys</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
@@ -0,0 +1,21 @@
|
||||
package com.yovinchen.xlcs;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
|
||||
/**
|
||||
* ClassName: ServiceSysApplication
|
||||
* Package: com.yovinchen.xlcs.sys
|
||||
*
|
||||
* @author yovinchen
|
||||
* @Create 2023/9/14 15:36
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableDiscoveryClient
|
||||
public class ServiceSysApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ServiceSysApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,45 @@
|
||||
package com.yovinchen.xlcs.sys.controller;
|
||||
|
||||
|
||||
import com.yovinchen.xlcs.common.result.Result;
|
||||
import com.yovinchen.xlcs.model.sys.Region;
|
||||
import com.yovinchen.xlcs.sys.service.RegionService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 地区表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author yovinchen
|
||||
* @since 2023-09-14
|
||||
*/
|
||||
@Api(value = "地区接口", tags = "地区接口")
|
||||
@RestController
|
||||
@RequestMapping("/admin/sys/region")
|
||||
|
||||
public class RegionController {
|
||||
|
||||
@Autowired
|
||||
private RegionService regionService;
|
||||
|
||||
@ApiOperation("根据区域关键字查询区域列表信息")
|
||||
@GetMapping("findRegionByKeyword/{keyword}")
|
||||
public Result findRegionByKeyword(@PathVariable("keyword") String keyword) {
|
||||
try {
|
||||
List<Region> list = regionService.getRegionByKeyword(keyword);
|
||||
return Result.ok(list);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("根据区域关键字查询区域列表信息异常", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,81 @@
|
||||
package com.yovinchen.xlcs.sys.controller;
|
||||
|
||||
|
||||
import com.yovinchen.xlcs.common.result.Result;
|
||||
import com.yovinchen.xlcs.model.sys.RegionWare;
|
||||
import com.yovinchen.xlcs.sys.service.RegionWareService;
|
||||
import com.yovinchen.xlcs.vo.sys.RegionWareQueryVo;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 城市仓库关联表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author yovinchen
|
||||
* @since 2023-09-14
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(value = "/admin/sys/regionWare")
|
||||
@Api(value = "开通区域接口", tags = "开通区域接口")
|
||||
public class RegionWareController {
|
||||
@Autowired
|
||||
private RegionWareService regionWareService;
|
||||
|
||||
|
||||
//TODO 分页查询错误
|
||||
@ApiOperation(value = "获取开通区域列表")
|
||||
@GetMapping("{page}/{limit}")
|
||||
public Result index(@ApiParam(name = "page", value = "当前页码", required = true) @PathVariable Long page,
|
||||
@ApiParam(name = "limit", value = "每页记录数", required = true) @PathVariable Long limit,
|
||||
@ApiParam(name = "regionWareVo", value = "查询对象", required = false) RegionWareQueryVo regionWareQueryVo) {
|
||||
try {
|
||||
Page<RegionWare> pageParam = new Page<>(page, limit);
|
||||
IPage<RegionWare> pageModel = regionWareService.selectPage(pageParam, regionWareQueryVo);
|
||||
return Result.ok(pageModel);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("获取开通区域列表异常", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增开通区域")
|
||||
@PostMapping("save")
|
||||
public Result save(@RequestBody RegionWare regionWare) {
|
||||
try {
|
||||
regionWareService.saveRegionWare(regionWare);
|
||||
return Result.ok(null);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("新增开通区域异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除开通区域")
|
||||
@DeleteMapping("remove/{id}")
|
||||
public Result remove(@PathVariable Long id) {
|
||||
try {
|
||||
boolean result = regionWareService.removeById(id);
|
||||
return result ? Result.ok(null) : Result.fail(null);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("删除开通区域异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "取消开通区域")
|
||||
@PostMapping("updateStatus/{id}/{status}")
|
||||
public Result updateStatus(@PathVariable Long id, @PathVariable Integer status) {
|
||||
try {
|
||||
regionWareService.updateStatus(id, status);
|
||||
return Result.ok(null);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("删除开通区域异常", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,44 @@
|
||||
package com.yovinchen.xlcs.sys.controller;
|
||||
|
||||
|
||||
import com.yovinchen.xlcs.common.result.Result;
|
||||
import com.yovinchen.xlcs.model.sys.Ware;
|
||||
import com.yovinchen.xlcs.sys.service.WareService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 仓库表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author yovinchen
|
||||
* @since 2023-09-14
|
||||
*/
|
||||
@Api(value = "仓库接口", tags = "仓库接口")
|
||||
@RestController
|
||||
@RequestMapping("/admin/sys/ware")
|
||||
|
||||
public class WareController {
|
||||
|
||||
@Autowired
|
||||
private WareService wareService;
|
||||
|
||||
@ApiOperation("查询所有仓库列表")
|
||||
@GetMapping("findAllList")
|
||||
public Result findAllList() {
|
||||
try {
|
||||
List<Ware> list = wareService.list();
|
||||
return Result.ok(list);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("查询所有仓库列表异常", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,18 @@
|
||||
package com.yovinchen.xlcs.sys.mapper;
|
||||
|
||||
import com.yovinchen.xlcs.model.sys.Region;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 地区表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author yovinchen
|
||||
* @since 2023-09-14
|
||||
*/
|
||||
@Repository
|
||||
public interface RegionMapper extends BaseMapper<Region> {
|
||||
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
package com.yovinchen.xlcs.sys.mapper;
|
||||
|
||||
import com.yovinchen.xlcs.model.sys.RegionWare;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 城市仓库关联表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author yovinchen
|
||||
* @since 2023-09-14
|
||||
*/
|
||||
@Repository
|
||||
public interface RegionWareMapper extends BaseMapper<RegionWare> {
|
||||
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
package com.yovinchen.xlcs.sys.mapper;
|
||||
|
||||
|
||||
import com.yovinchen.xlcs.model.sys.Ware;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 仓库表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author yovinchen
|
||||
* @since 2023-09-14
|
||||
*/
|
||||
@Repository
|
||||
public interface WareMapper extends BaseMapper<Ware> {
|
||||
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
<?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.yovinchen.xlcs.sys.mapper.RegionMapper">
|
||||
|
||||
</mapper>
|
@@ -0,0 +1,5 @@
|
||||
<?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.yovinchen.xlcs.sys.mapper.RegionWareMapper">
|
||||
|
||||
</mapper>
|
@@ -0,0 +1,5 @@
|
||||
<?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.yovinchen.xlcs.sys.mapper.WareMapper">
|
||||
|
||||
</mapper>
|
@@ -0,0 +1,20 @@
|
||||
package com.yovinchen.xlcs.sys.service;
|
||||
|
||||
|
||||
import com.yovinchen.xlcs.model.sys.Region;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 地区表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author yovinchen
|
||||
* @since 2023-09-14
|
||||
*/
|
||||
public interface RegionService extends IService<Region> {
|
||||
|
||||
List<Region> getRegionByKeyword(String keyword);
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
package com.yovinchen.xlcs.sys.service;
|
||||
|
||||
|
||||
import com.yovinchen.xlcs.model.sys.RegionWare;
|
||||
import com.yovinchen.xlcs.vo.sys.RegionWareQueryVo;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 城市仓库关联表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author yovinchen
|
||||
* @since 2023-09-14
|
||||
*/
|
||||
public interface RegionWareService extends IService<RegionWare> {
|
||||
|
||||
IPage<RegionWare> selectPage(Page<RegionWare> pageParam, RegionWareQueryVo regionWareQueryVo);
|
||||
|
||||
void saveRegionWare(RegionWare regionWare);
|
||||
|
||||
void updateStatus(Long id, Integer status);
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
package com.yovinchen.xlcs.sys.service;
|
||||
|
||||
|
||||
import com.yovinchen.xlcs.model.sys.Ware;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 仓库表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author yovinchen
|
||||
* @since 2023-09-14
|
||||
*/
|
||||
public interface WareService extends IService<Ware> {
|
||||
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
package com.yovinchen.xlcs.sys.service.impl;
|
||||
|
||||
|
||||
import com.yovinchen.xlcs.model.sys.Region;
|
||||
import com.yovinchen.xlcs.sys.mapper.RegionMapper;
|
||||
import com.yovinchen.xlcs.sys.service.RegionService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 地区表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author yovinchen
|
||||
* @since 2023-09-14
|
||||
*/
|
||||
@Service
|
||||
public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> implements RegionService {
|
||||
|
||||
@Override
|
||||
public List<Region> getRegionByKeyword(String keyword) {
|
||||
return baseMapper.selectList(new LambdaQueryWrapper<Region>().like(Region::getName, keyword));
|
||||
}
|
||||
}
|
@@ -0,0 +1,65 @@
|
||||
package com.yovinchen.xlcs.sys.service.impl;
|
||||
|
||||
import com.yovinchen.xlcs.common.exception.xlcsException;
|
||||
import com.yovinchen.xlcs.common.result.ResultCodeEnum;
|
||||
import com.yovinchen.xlcs.model.sys.RegionWare;
|
||||
import com.yovinchen.xlcs.sys.mapper.RegionWareMapper;
|
||||
import com.yovinchen.xlcs.sys.service.RegionWareService;
|
||||
import com.yovinchen.xlcs.vo.sys.RegionWareQueryVo;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 城市仓库关联表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author yovinchen
|
||||
* @since 2023-09-14
|
||||
*/
|
||||
@Service
|
||||
public class RegionWareServiceImpl extends ServiceImpl<RegionWareMapper, RegionWare> implements RegionWareService {
|
||||
|
||||
|
||||
@Autowired
|
||||
RegionWareMapper regionWareMapper;
|
||||
|
||||
//开通区域列表
|
||||
@Override
|
||||
public IPage<RegionWare> selectPage(Page<RegionWare> pageParam, RegionWareQueryVo regionWareQueryVo) {
|
||||
String keyword = regionWareQueryVo.getKeyword();
|
||||
LambdaQueryWrapper<RegionWare> wrapper = new LambdaQueryWrapper<>();
|
||||
if (!StringUtils.isEmpty(keyword)) {
|
||||
wrapper
|
||||
.like(RegionWare::getRegionName, keyword)
|
||||
.or()
|
||||
.like(RegionWare::getWareName, keyword);
|
||||
}
|
||||
IPage<RegionWare> regionWarePage = baseMapper.selectPage(pageParam, wrapper);
|
||||
return regionWarePage;
|
||||
}
|
||||
|
||||
//添加开通区域
|
||||
@Override
|
||||
public void saveRegionWare(RegionWare regionWare) {
|
||||
LambdaQueryWrapper<RegionWare> queryWrapper = new LambdaQueryWrapper();
|
||||
queryWrapper.eq(RegionWare::getRegionId, regionWare.getRegionId());
|
||||
Integer count = regionWareMapper.selectCount(queryWrapper);
|
||||
if (count > 0) {
|
||||
throw new xlcsException(ResultCodeEnum.REGION_OPEN);
|
||||
}
|
||||
baseMapper.insert(regionWare);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatus(Long id, Integer status) {
|
||||
RegionWare regionWare = baseMapper.selectById(id);
|
||||
regionWare.setStatus(status);
|
||||
baseMapper.updateById(regionWare);
|
||||
}
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
package com.yovinchen.xlcs.sys.service.impl;
|
||||
|
||||
import com.yovinchen.xlcs.model.sys.Ware;
|
||||
import com.yovinchen.xlcs.sys.mapper.WareMapper;
|
||||
import com.yovinchen.xlcs.sys.service.WareService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 仓库表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author yovinchen
|
||||
* @since 2023-09-14
|
||||
*/
|
||||
@Service
|
||||
public class WareServiceImpl extends ServiceImpl<WareMapper, Ware> implements WareService {
|
||||
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
server:
|
||||
port: 8202
|
||||
spring:
|
||||
application:
|
||||
name: service-sys
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 82.157.68.223:8848
|
||||
username: nacos
|
||||
password: nacos
|
@@ -0,0 +1,18 @@
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
config:
|
||||
namespace: dd5265c5-8290-45bc-9d07-395c14c977d3
|
||||
server-addr: 82.157.68.223:8848
|
||||
group: service
|
||||
username: nacos
|
||||
password: nacos
|
||||
enabled: true
|
||||
file-extension: yml
|
||||
extension-configs:
|
||||
- data-id: common.yml
|
||||
group: common
|
||||
refresh: true
|
||||
- data-id: service-redis.yml
|
||||
group: common
|
||||
refresh: true
|
Reference in New Issue
Block a user