jinlin
2024-04-02 3594ee8af853949d39589f4dbdf86c7f5d7f088b
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/sysPictureBase/controller/SysPictureBaseController.java
@@ -50,7 +50,8 @@
    @ApiImplicitParams({
            @ApiImplicitParam(name = Constant.Q.ORDER_FIELD, value = Constant.QV.ORDER_FIELD, dataType = Constant.QT.STRING),
            @ApiImplicitParam(name = Constant.Q.ORDER, value = Constant.QV.ORDER, dataType = Constant.QT.STRING),
            @ApiImplicitParam(name = "productType", value = "检索关键字", dataType = Constant.QT.STRING, format = "CONTENT_TYPE^LK"), @ApiImplicitParam(name = "systemMark", value = "系统标识", dataType = Constant.QT.STRING, format = "SYSTEM_MARK^LK")})
            @ApiImplicitParam(name = "productType", value = "检索关键字", dataType = Constant.QT.STRING, format = "PRODUCT_TYPE^EQ"),
            @ApiImplicitParam(name = "systemMark", value = "系统标识", dataType = Constant.QT.STRING, format = "SYSTEM_MARK^LK")})
    public Result<List<SysPictureBase>> page(@ApiIgnore @QueryParam QueryFilter queryFilter) {
        return Result.ok(sysPictureBaseService.page(queryFilter));
@@ -69,6 +70,7 @@
    public Result save(@RequestBody MultipartFile file, Long id, Integer isDefault,
                       String name, String contentType, Integer productType,  String remark) {
        SysPictureBase sysPictureBase;
        SysPictureBase pictureBase = sysPictureBaseService.getDefaultImg(productType);
        if (id != 0) {
            sysPictureBase = sysPictureBaseService.get(id);
            sysPictureBase.setIsDefault(isDefault);
@@ -87,8 +89,15 @@
            sysPictureBaseService.insert(sysPictureBase);
        }
        if (sysPictureBase.getIsDefault()==1){
            sysPictureBaseService.updateByDefault(sysPictureBase.getId(),sysPictureBase.getProductType());
            sysPictureBaseService.updateProdeuctImg(sysPictureBase.getId(),sysPictureBase.getProductType());
            if (pictureBase.getId()==null){
                sysPictureBaseService.updateByDefault(sysPictureBase.getId(),sysPictureBase.getProductType());
                sysPictureBaseService.updateProdeuctImg(sysPictureBase.getId(),sysPictureBase.getProductType(),null);
            }else{
                if (!sysPictureBase.getId().equals(pictureBase.getId())){
                    sysPictureBaseService.updateByDefault(sysPictureBase.getId(),sysPictureBase.getProductType());
                    sysPictureBaseService.updateProdeuctImg(sysPictureBase.getId(),sysPictureBase.getProductType(),pictureBase.getId());
                }
            }
        }
        if (file != null) {
            BufferedImage bufferedImage = null;
@@ -148,6 +157,11 @@
        }
    }
    @GetMapping("/getDefaultImg")
    public Result<SysPictureBase> getDefaultImg(Integer productType) {
        SysPictureBase data = sysPictureBaseService.getDefaultImg(productType);
        return Result.ok(data);
    }
    @DeleteMapping
    @ApiOperation("删除")
    @LogOperation("删除")