zhenghaoyu
10 months ago
9 changed files with 238 additions and 2 deletions
@ -0,0 +1,69 @@
|
||||
package com.logpm.basicdata.controller; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||
import com.logpm.basicdata.dto.BasicdataFactoryCategoryDTO; |
||||
import com.logpm.basicdata.entity.BasicdataFactoryCategoryEntity; |
||||
import com.logpm.basicdata.service.IBasicdataFactoryCategoryService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.common.exception.CustomerException; |
||||
import org.springblade.core.boot.ctrl.BladeController; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
@Slf4j |
||||
@RestController |
||||
@AllArgsConstructor |
||||
@RequestMapping("/factoryCategory") |
||||
@Api(value = "工厂物料映射", tags = "工厂物料映射接口") |
||||
public class BasicdataFactoryCategoryController extends BladeController { |
||||
|
||||
private final IBasicdataFactoryCategoryService basicdataFactoryCategoryService; |
||||
|
||||
|
||||
|
||||
@ResponseBody |
||||
@PostMapping("/pageList") |
||||
@ApiOperationSupport(order = 1) |
||||
@ApiOperation(value = "提货单列表", notes = "传入basicdataFactoryCategoryDTO") |
||||
public R pageList(@RequestBody BasicdataFactoryCategoryDTO basicdataFactoryCategoryDTO) { |
||||
String method = "############pageList: "; |
||||
log.info(method+"请求参数{}",basicdataFactoryCategoryDTO); |
||||
try{ |
||||
|
||||
IPage<BasicdataFactoryCategoryEntity> pages = basicdataFactoryCategoryService.pageList(basicdataFactoryCategoryDTO); |
||||
return R.data(pages); |
||||
}catch (CustomerException e){ |
||||
log.error(e.message,e); |
||||
return R.fail(e.code,e.message); |
||||
}catch (Exception e){ |
||||
log.error("############sendOrders: 系统异常",e); |
||||
return R.fail(500,"############sendOrders: 系统异常"); |
||||
} |
||||
} |
||||
|
||||
|
||||
@ResponseBody |
||||
@PostMapping("/save") |
||||
@ApiOperationSupport(order = 1) |
||||
@ApiOperation(value = "提货单列表", notes = "传入basicdataFactoryCategoryDTO") |
||||
public R save(@RequestBody BasicdataFactoryCategoryDTO basicdataFactoryCategoryDTO) { |
||||
String method = "############save: "; |
||||
log.info(method+"请求参数{}",basicdataFactoryCategoryDTO); |
||||
try{ |
||||
return basicdataFactoryCategoryService.saveEntity(basicdataFactoryCategoryDTO); |
||||
}catch (CustomerException e){ |
||||
log.error(e.message,e); |
||||
return R.fail(e.code,e.message); |
||||
}catch (Exception e){ |
||||
log.error("############sendOrders: 系统异常",e); |
||||
return R.fail(500,"############sendOrders: 系统异常"); |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,12 @@
|
||||
package com.logpm.basicdata.dto; |
||||
|
||||
import com.logpm.basicdata.entity.BasicdataFactoryCategoryEntity; |
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class BasicdataFactoryCategoryDTO extends BasicdataFactoryCategoryEntity { |
||||
|
||||
private Integer pageSize; |
||||
private Integer pageNum; |
||||
|
||||
} |
@ -0,0 +1,20 @@
|
||||
package com.logpm.basicdata.feign; |
||||
|
||||
import com.logpm.basicdata.entity.BasicdataFactoryCategoryEntity; |
||||
import com.logpm.basicdata.service.IBasicdataFactoryCategoryService; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
import springfox.documentation.annotations.ApiIgnore; |
||||
|
||||
@ApiIgnore() |
||||
@RestController |
||||
@AllArgsConstructor |
||||
public class BasicdataFactoryCategoryEntityClient implements IBasicdataFactoryCategoryClient{ |
||||
|
||||
private final IBasicdataFactoryCategoryService factoryCategoryService; |
||||
|
||||
@Override |
||||
public BasicdataFactoryCategoryEntity findEntityByAdvanceDetailIds(Integer current, Integer size) { |
||||
return null; |
||||
} |
||||
} |
@ -0,0 +1,19 @@
|
||||
package com.logpm.basicdata.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.logpm.basicdata.dto.BasicdataFactoryCategoryDTO; |
||||
import com.logpm.basicdata.entity.BasicdataFactoryCategoryEntity; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
@Mapper |
||||
public interface BasicdataFactoryCategoryMapper extends BaseMapper<BasicdataFactoryCategoryEntity> { |
||||
|
||||
|
||||
IPage<BasicdataFactoryCategoryEntity> pageList(IPage<Object> page,@Param("param") BasicdataFactoryCategoryDTO basicdataFactoryCategoryDTO); |
||||
|
||||
|
||||
BasicdataFactoryCategoryEntity findEntityByParam(@Param("param") BasicdataFactoryCategoryDTO basicdataFactoryCategoryDTO); |
||||
|
||||
} |
@ -0,0 +1,40 @@
|
||||
<?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.logpm.basicdata.mapper.BasicdataFactoryCategoryMapper"> |
||||
|
||||
<select id="pageList" resultType="com.logpm.basicdata.entity.BasicdataFactoryCategoryEntity"> |
||||
select * |
||||
from logpm_basicdata_factory_category |
||||
where 1=1 |
||||
<if test="param.brand != null and param.brand != ''"> |
||||
and brand = #{param.brand} |
||||
</if> |
||||
</select> |
||||
|
||||
<select id="findEntityByParam" resultType="com.logpm.basicdata.entity.BasicdataFactoryCategoryEntity"> |
||||
select * |
||||
from logpm_basicdata_factory_category |
||||
where 1=1 |
||||
and brand = #{param.brand} |
||||
and is_deleted = 0 |
||||
<if test="param.firsts == null or param.firsts == ''"> |
||||
and (firsts is null or firsts = '') |
||||
</if> |
||||
<if test="param.firsts != null and param.firsts != ''"> |
||||
and firsts = #{param.firsts} |
||||
</if> |
||||
<if test="param.seconds == null or param.seconds == ''"> |
||||
and (seconds is null or seconds = '') |
||||
</if> |
||||
<if test="param.seconds != null and param.seconds != ''"> |
||||
and seconds = #{param.seconds} |
||||
</if> |
||||
<if test="param.thirds == null or param.thirds == ''"> |
||||
and (thirds is null or thirds = '') |
||||
</if> |
||||
<if test="param.thirds != null and param.thirds != ''"> |
||||
and thirds = #{param.thirds} |
||||
</if> |
||||
</select> |
||||
|
||||
</mapper> |
@ -0,0 +1,17 @@
|
||||
package com.logpm.basicdata.service; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.logpm.basicdata.dto.BasicdataFactoryCategoryDTO; |
||||
import com.logpm.basicdata.entity.BasicdataFactoryCategoryEntity; |
||||
import com.logpm.basicdata.entity.BasicdataFreightEntity; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
import org.springblade.core.tool.api.R; |
||||
|
||||
public interface IBasicdataFactoryCategoryService extends BaseService<BasicdataFactoryCategoryEntity> { |
||||
|
||||
|
||||
IPage<BasicdataFactoryCategoryEntity> pageList(BasicdataFactoryCategoryDTO basicdataFactoryCategoryDTO); |
||||
|
||||
R saveEntity(BasicdataFactoryCategoryDTO basicdataFactoryCategoryDTO); |
||||
|
||||
} |
@ -0,0 +1,49 @@
|
||||
package com.logpm.basicdata.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import com.logpm.basicdata.dto.BasicdataFactoryCategoryDTO; |
||||
import com.logpm.basicdata.entity.BasicdataFactoryCategoryEntity; |
||||
import com.logpm.basicdata.mapper.BasicdataFactoryCategoryMapper; |
||||
import com.logpm.basicdata.service.IBasicdataFactoryCategoryService; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.Objects; |
||||
|
||||
@Slf4j |
||||
@Service |
||||
@AllArgsConstructor |
||||
public class BasicdataFactoryCategoryServiceImpl extends BaseServiceImpl<BasicdataFactoryCategoryMapper, BasicdataFactoryCategoryEntity> implements IBasicdataFactoryCategoryService { |
||||
|
||||
|
||||
@Override |
||||
public IPage<BasicdataFactoryCategoryEntity> pageList(BasicdataFactoryCategoryDTO basicdataFactoryCategoryDTO) { |
||||
IPage<Object> page = new Page<>(); |
||||
page.setCurrent(basicdataFactoryCategoryDTO.getPageNum()); |
||||
page.setSize(basicdataFactoryCategoryDTO.getPageSize()); |
||||
|
||||
IPage<BasicdataFactoryCategoryEntity> pageList = baseMapper.pageList(page,basicdataFactoryCategoryDTO); |
||||
|
||||
return pageList; |
||||
} |
||||
|
||||
@Override |
||||
public R saveEntity(BasicdataFactoryCategoryDTO basicdataFactoryCategoryDTO) { |
||||
|
||||
BasicdataFactoryCategoryEntity basicdataFactoryCategoryEntity = baseMapper.findEntityByParam(basicdataFactoryCategoryDTO); |
||||
|
||||
if(Objects.isNull(basicdataFactoryCategoryEntity)){ |
||||
log.warn("############saveEntity: 已存在该配置"); |
||||
return R.fail(405,"已存在该配置"); |
||||
} |
||||
|
||||
save(basicdataFactoryCategoryDTO); |
||||
|
||||
return R.success("保存成功"); |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue