|
|
|
@ -3,8 +3,10 @@ package org.jeecg.modules.zystylefabric.controller; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Arrays; |
|
|
|
|
import java.util.List; |
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
|
|
import org.jeecg.common.api.vo.Result; |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -19,6 +21,7 @@ import org.jeecg.modules.zyclothsstyle.entity.ZyClothsStyle; |
|
|
|
|
import org.jeecg.modules.zyclothsstyle.service.IZyClothsStyleService; |
|
|
|
|
import org.jeecg.modules.zystylefabric.entity.NewZyStyleFabric; |
|
|
|
|
import org.jeecg.modules.zystylefabric.entity.ZyStyleFabric; |
|
|
|
|
import org.jeecg.modules.zystylefabric.mapper.ZyStyleFabricMapper; |
|
|
|
|
import org.jeecg.modules.zystylefabric.service.INewZyStyleFabricService; |
|
|
|
|
import org.jeecg.modules.zystylefabric.service.IZyStyleFabricService; |
|
|
|
|
import org.jeecg.common.system.base.controller.JeecgController; |
|
|
|
@ -29,13 +32,13 @@ import io.swagger.annotations.Api; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
import org.jeecg.common.aspect.annotation.AutoLog; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
/** |
|
|
|
|
* @Description: 款式面料表 |
|
|
|
|
* @Author: jeecg-boot |
|
|
|
|
* @Date: 2022-09-15 |
|
|
|
|
* @Version: V1.0 |
|
|
|
|
*/ |
|
|
|
|
@Api(tags="款式面料表") |
|
|
|
|
@Api(tags = "款式面料表") |
|
|
|
|
@RestController |
|
|
|
|
@RequestMapping("/zystylefabric/zyStyleFabric") |
|
|
|
|
@Slf4j |
|
|
|
@ -49,6 +52,9 @@ public class ZyStyleFabricController extends JeecgController<ZyStyleFabric, IZyS |
|
|
|
|
@Autowired |
|
|
|
|
private IZyFabricService zyFabricService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private ZyStyleFabricMapper zyStyleFabricMapper; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 分页列表查询 |
|
|
|
|
* |
|
|
|
@ -59,34 +65,39 @@ public class ZyStyleFabricController extends JeecgController<ZyStyleFabric, IZyS |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
//@AutoLog(value = "款式面料表-分页列表查询")
|
|
|
|
|
@ApiOperation(value="款式面料表-分页列表查询", notes="款式面料表-分页列表查询") |
|
|
|
|
@ApiOperation(value = "款式面料表-分页列表查询", notes = "款式面料表-分页列表查询") |
|
|
|
|
@GetMapping(value = "/list") |
|
|
|
|
public Result<IPage<NewZyStyleFabric>> queryPageList(ZyStyleFabric zyStyleFabric,String id, |
|
|
|
|
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
|
|
|
|
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
|
|
|
|
public Result<IPage<NewZyStyleFabric>> queryPageList(ZyStyleFabric zyStyleFabric, String id, |
|
|
|
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
|
|
|
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
|
|
|
|
HttpServletRequest req) { |
|
|
|
|
QueryWrapper<ZyStyleFabric> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
if(id!=null){ |
|
|
|
|
queryWrapper.eq("style_id",id); |
|
|
|
|
if (id != null) { |
|
|
|
|
queryWrapper.eq("style_id", id); |
|
|
|
|
} |
|
|
|
|
if(zyStyleFabric.getStyleId()!=null || zyStyleFabric.getFabricId()!=null ){ |
|
|
|
|
if(zyStyleFabric.getStyleId()!=null){ |
|
|
|
|
queryWrapper.eq("style_id",zyStyleFabric.getStyleId()); |
|
|
|
|
if (zyStyleFabric.getStyleId() != null || zyStyleFabric.getFabricId() != null) { |
|
|
|
|
if (zyStyleFabric.getStyleId() != null) { |
|
|
|
|
queryWrapper.eq("style_id", zyStyleFabric.getStyleId()); |
|
|
|
|
} |
|
|
|
|
if(zyStyleFabric.getFabricId()!=null){ |
|
|
|
|
queryWrapper.eq("fabric_id",zyStyleFabric.getFabricId()); |
|
|
|
|
if (zyStyleFabric.getFabricId() != null) { |
|
|
|
|
queryWrapper.eq("fabric_id", zyStyleFabric.getFabricId()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
List<ZyStyleFabric> list = zyStyleFabricService.list(queryWrapper); |
|
|
|
|
List<NewZyStyleFabric> newZyStyleFabrics = new ArrayList<>(); |
|
|
|
|
for (ZyStyleFabric zyStyleF : list){ |
|
|
|
|
System.out.println("****"+zyStyleF); |
|
|
|
|
for (ZyStyleFabric zyStyleF : list) { |
|
|
|
|
System.out.println("****" + zyStyleF); |
|
|
|
|
NewZyStyleFabric newZySF = new NewZyStyleFabric(); |
|
|
|
|
//编辑回显
|
|
|
|
|
newZySF.setId(zyStyleF.getId()); |
|
|
|
|
newZySF.setFabricId(zyStyleF.getFabricId()); |
|
|
|
|
newZySF.setStyleId(zyStyleF.getStyleId()); |
|
|
|
|
|
|
|
|
|
//拿到服装类型名称
|
|
|
|
|
String typeName = zyStyleFabricMapper.getTypeName(newZySF.getStyleId()); |
|
|
|
|
newZySF.setTypeName(typeName); |
|
|
|
|
|
|
|
|
|
//款式编号和名称
|
|
|
|
|
String styleId = zyStyleF.getStyleId(); |
|
|
|
|
ZyClothsStyle styleById = zyClothsStyleService.getById(styleId); |
|
|
|
@ -114,19 +125,19 @@ public class ZyStyleFabricController extends JeecgController<ZyStyleFabric, IZyS |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@AutoLog(value = "款式面料表-添加") |
|
|
|
|
@ApiOperation(value="款式面料表-添加", notes="款式面料表-添加") |
|
|
|
|
@ApiOperation(value = "款式面料表-添加", notes = "款式面料表-添加") |
|
|
|
|
//@RequiresPermissions("org.jeecg.modules.demo:zy_style_fabric:add")
|
|
|
|
|
@PostMapping(value = "/add") |
|
|
|
|
public Result<Object> add(@RequestBody ZyStyleFabric zyStyleFabric) { |
|
|
|
|
String[] split = zyStyleFabric.getFabricId().split(","); |
|
|
|
|
QueryWrapper queryWrapper=new QueryWrapper(); |
|
|
|
|
queryWrapper.eq("style_id",zyStyleFabric.getStyleId()); |
|
|
|
|
QueryWrapper queryWrapper = new QueryWrapper(); |
|
|
|
|
queryWrapper.eq("style_id", zyStyleFabric.getStyleId()); |
|
|
|
|
for (String s : split) { |
|
|
|
|
zyStyleFabric.setFabricId(s); |
|
|
|
|
zyStyleFabric.setId(null); |
|
|
|
|
queryWrapper.eq("fabric_id",zyStyleFabric.getFabricId()); |
|
|
|
|
int a=zyStyleFabricService.count(queryWrapper); |
|
|
|
|
if(a>=1) |
|
|
|
|
queryWrapper.eq("fabric_id", zyStyleFabric.getFabricId()); |
|
|
|
|
int a = zyStyleFabricService.count(queryWrapper); |
|
|
|
|
if (a >= 1) |
|
|
|
|
return Result.error("存在以添加过的数据!!!"); |
|
|
|
|
zyStyleFabricService.save(zyStyleFabric); |
|
|
|
|
} |
|
|
|
@ -140,9 +151,9 @@ public class ZyStyleFabricController extends JeecgController<ZyStyleFabric, IZyS |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@AutoLog(value = "款式面料表-编辑") |
|
|
|
|
@ApiOperation(value="款式面料表-编辑", notes="款式面料表-编辑") |
|
|
|
|
@ApiOperation(value = "款式面料表-编辑", notes = "款式面料表-编辑") |
|
|
|
|
//@RequiresPermissions("org.jeecg.modules.demo:zy_style_fabric:edit")
|
|
|
|
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) |
|
|
|
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) |
|
|
|
|
public Result<String> edit(@RequestBody ZyStyleFabric zyStyleFabric) { |
|
|
|
|
zyStyleFabricService.updateById(zyStyleFabric); |
|
|
|
|
return Result.OK("编辑成功!"); |
|
|
|
@ -155,10 +166,10 @@ public class ZyStyleFabricController extends JeecgController<ZyStyleFabric, IZyS |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@AutoLog(value = "款式面料表-通过id删除") |
|
|
|
|
@ApiOperation(value="款式面料表-通过id删除", notes="款式面料表-通过id删除") |
|
|
|
|
@ApiOperation(value = "款式面料表-通过id删除", notes = "款式面料表-通过id删除") |
|
|
|
|
//@RequiresPermissions("org.jeecg.modules.demo:zy_style_fabric:delete")
|
|
|
|
|
@DeleteMapping(value = "/delete") |
|
|
|
|
public Result<String> delete(@RequestParam(name="id",required=true) String id) { |
|
|
|
|
public Result<String> delete(@RequestParam(name = "id", required = true) String id) { |
|
|
|
|
zyStyleFabricService.removeById(id); |
|
|
|
|
return Result.OK("删除成功!"); |
|
|
|
|
} |
|
|
|
@ -170,10 +181,10 @@ public class ZyStyleFabricController extends JeecgController<ZyStyleFabric, IZyS |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@AutoLog(value = "款式面料表-批量删除") |
|
|
|
|
@ApiOperation(value="款式面料表-批量删除", notes="款式面料表-批量删除") |
|
|
|
|
@ApiOperation(value = "款式面料表-批量删除", notes = "款式面料表-批量删除") |
|
|
|
|
//@RequiresPermissions("org.jeecg.modules.demo:zy_style_fabric:deleteBatch")
|
|
|
|
|
@DeleteMapping(value = "/deleteBatch") |
|
|
|
|
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { |
|
|
|
|
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { |
|
|
|
|
this.zyStyleFabricService.removeByIds(Arrays.asList(ids.split(","))); |
|
|
|
|
return Result.OK("批量删除成功!"); |
|
|
|
|
} |
|
|
|
@ -185,11 +196,11 @@ public class ZyStyleFabricController extends JeecgController<ZyStyleFabric, IZyS |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
//@AutoLog(value = "款式面料表-通过id查询")
|
|
|
|
|
@ApiOperation(value="款式面料表-通过id查询", notes="款式面料表-通过id查询") |
|
|
|
|
@ApiOperation(value = "款式面料表-通过id查询", notes = "款式面料表-通过id查询") |
|
|
|
|
@GetMapping(value = "/queryById") |
|
|
|
|
public Result<?> queryById(@RequestParam(name="id",required=true) String id) { |
|
|
|
|
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) { |
|
|
|
|
ZyStyleFabric zyStyleFabric = zyStyleFabricService.getById(id); |
|
|
|
|
if(zyStyleFabric==null) { |
|
|
|
|
if (zyStyleFabric == null) { |
|
|
|
|
return Result.error("未找到对应数据"); |
|
|
|
|
} |
|
|
|
|
return Result.OK(zyStyleFabric); |
|
|
|
|