Commit bb5a9983 authored by liqin's avatar liqin 💬

bug fixed

parent d726ac9c
......@@ -5,26 +5,26 @@ package cn.wisenergy.chnmuseum.party.common.enums;
*/
public enum AuditStatusEnum {
TBC("1", "待审核"),
REFUSED("2", "已驳回"),
APPROVED_FIRST("3", "初审通过");
TBC(1, "待审核"),
REFUSED(2, "已驳回"),
APPROVED_FIRST(3, "初审通过");
// 错误编码
private String code;
private Integer code;
// 信息
private String msg;
// 相应编码有参构造函数
AuditStatusEnum(String code, String msg) {
AuditStatusEnum(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public String getCode() {
public Integer getCode() {
return code;
}
public void setCode(String code) {
public void setCode(Integer code) {
this.code = code;
}
......
package cn.wisenergy.chnmuseum.party.common.enums;
/**
* 版权方类型枚举
*/
public enum CopyrightOwnerTypeEnum {
ASSET(1, "视频"),
EXHIBITION_BOARD(2, "展板");
// 错误编码
private Integer code;
// 信息
private String type;
CopyrightOwnerTypeEnum(Integer code, String type) {
this.code = code;
this.type = type;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
......@@ -49,7 +49,7 @@ public class Asset implements Serializable {
private String assetCopyrightOwnerId;
@ApiModelProperty("视频类别ID")
@TableField("asset_type_id")
@TableField(value = "asset_type_id", updateStrategy = FieldStrategy.IGNORED)
@NotBlank(message = "视频类别ID不能为空", groups = {Add.class, Update.class})
private String assetTypeId;
......
package cn.wisenergy.chnmuseum.party.model;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Add;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Update;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.*;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;
......@@ -15,37 +19,43 @@ import java.time.LocalDateTime;
* </p>
*
* @author Danny Lee
* @since 2021-03-16
* @since 2021-03-17
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@TableName("asset_type")
@ApiModel(value = "AssetType对象", description = "视频分类")
@ApiModel(value = "视频分类", description = "视频分类")
public class AssetType implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "视频分类ID")
@ApiModelProperty("视频分类ID")
@TableId(value = "id", type = IdType.ASSIGN_ID)
@NotNull(message = "视频分类ID不能为空", groups = {Update.class})
private String id;
@ApiModelProperty(value = "视频分类名称")
@ApiModelProperty("视频分类名称")
@TableField("name")
@NotBlank(message = "视频分类名称不能为空", groups = {Add.class, Update.class})
private String name;
@ApiModelProperty(value = "备注")
@ApiModelProperty("备注")
@TableField("remarks")
private String remarks;
@ApiModelProperty(value = "版权方ID")
@ApiModelProperty("版权方ID")
@TableField("copyright_owner_id")
private String copyrightOwnerId;
@ApiModelProperty(value = "创建日期")
@ApiModelProperty("创建日期")
@TableField(value = "create_time", fill = FieldFill.INSERT)
private LocalDateTime createTime;
@ApiModelProperty(value = "更新日期")
@ApiModelProperty("更新日期")
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
......
package cn.wisenergy.chnmuseum.party.model;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Add;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Update;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.*;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;
......@@ -15,45 +19,53 @@ import java.time.LocalDateTime;
* </p>
*
* @author Danny Lee
* @since 2021-03-16
* @since 2021-03-17
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@TableName("copyright_owner")
@ApiModel(value = "CopyrightOwner对象", description = "版权方")
@ApiModel(value = "版权方", description = "版权方")
public class CopyrightOwner implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "版权方ID")
@ApiModelProperty("版权方ID")
@TableId(value = "id", type = IdType.ASSIGN_ID)
@NotNull(message = "版权方ID不能为空", groups = {Update.class})
private String id;
@ApiModelProperty(value = "版权方名称")
@ApiModelProperty("版权方名称")
@TableField("name")
@NotBlank(message = "版权方名称不能为空", groups = {Add.class, Update.class})
private String name;
@ApiModelProperty(value = "版权方类型")
@ApiModelProperty("版权方类型")
@TableField("owner_type")
private Integer ownerType;
private String ownerType;
@ApiModelProperty(value = "版权方有效期开始")
@ApiModelProperty("版权方有效期开始")
@TableField("expire_date_start")
@NotNull(message = "版权方有效期开始不能为空", groups = {Add.class, Update.class})
private LocalDateTime expireDateStart;
@ApiModelProperty(value = "版权方有效期结束")
@ApiModelProperty("版权方有效期结束")
@TableField("expire_date_end")
@NotNull(message = "版权方有效期结束不能为空", groups = {Add.class, Update.class})
private LocalDateTime expireDateEnd;
@ApiModelProperty(value = "备注")
@ApiModelProperty("备注")
@TableField("remarks")
private String remarks;
@ApiModelProperty(value = "创建日期")
@ApiModelProperty("创建日期")
@TableField(value = "create_time", fill = FieldFill.INSERT)
private LocalDateTime createTime;
@ApiModelProperty(value = "更新日期")
@ApiModelProperty("更新日期")
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
......
package cn.wisenergy.chnmuseum.party.model;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Add;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Update;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.*;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
......@@ -17,25 +21,32 @@ import java.io.Serializable;
* </p>
*
* @author Danny Lee
* @since 2021-03-16
* @since 2021-03-17
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@TableName("copytight_owner_asset_type")
@ApiModel(value = "CopytightOwnerAssetType对象", description = "版权方视频分类")
@ApiModel(value = "版权方视频分类", description = "版权方视频分类")
public class CopytightOwnerAssetType implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.ASSIGN_ID)
@NotNull(message = "ID不能为空", groups = {Update.class})
private String id;
@ApiModelProperty(value = "版权方ID")
@ApiModelProperty("版权方ID")
@TableField("copyright_owner_id")
@NotBlank(message = "版权方ID不能为空", groups = {Add.class, Update.class})
private String copyrightOwnerId;
@ApiModelProperty(value = "视频分类ID")
@ApiModelProperty("视频分类ID")
@TableField("asset_type_id")
@NotBlank(message = "视频分类ID不能为空", groups = {Add.class, Update.class})
private String assetTypeId;
}
package cn.wisenergy.chnmuseum.party.model;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Add;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Update;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.*;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
......@@ -17,25 +21,32 @@ import java.io.Serializable;
* </p>
*
* @author Danny Lee
* @since 2021-03-16
* @since 2021-03-17
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@TableName("copytight_owner_board_type")
@ApiModel(value = "CopytightOwnerBoardType对象", description = "版权方展板分类")
@ApiModel(value = "版权方展板分类", description = "版权方展板分类")
public class CopytightOwnerBoardType implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.ASSIGN_ID)
@NotNull(message = "ID不能为空", groups = {Update.class})
private String id;
@ApiModelProperty(value = "版权方ID")
@ApiModelProperty("版权方ID")
@TableField("copyright_owner_id")
@NotBlank(message = "版权方ID不能为空", groups = {Add.class, Update.class})
private String copyrightOwnerId;
@ApiModelProperty(value = "展板分类ID")
@ApiModelProperty("展板分类ID")
@TableField("board_type_id")
@NotBlank(message = "展板分类ID不能为空", groups = {Add.class, Update.class})
private String boardTypeId;
}
package cn.wisenergy.chnmuseum.party.model;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.baomidou.mybatisplus.annotations.Version;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.time.LocalDateTime;
import javax.validation.constraints.NotNull;
import com.baomidou.mybatisplus.annotation.TableField;
/**
* <p>
......@@ -16,7 +30,7 @@ import java.time.LocalDateTime;
* </p>
*
* @author Danny Lee
* @since 2021-03-16
* @since 2021-03-17
*/
@Data
@Builder
......@@ -25,75 +39,75 @@ import java.time.LocalDateTime;
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@TableName("exhibition_board")
@ApiModel(value = "ExhibitionBoard对象", description = "展板")
@ApiModel(value = "展板", description = "展板")
public class ExhibitionBoard implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("展板内容ID")
@TableId(value = "id", type = IdType.ASSIGN_ID)
@NotNull(message = "展板内容IDID不能为空", groups = {Update.class})
private String id;
@ApiModelProperty("展板分类名称")
@TableField("name")
@NotBlank(message = "展板分类名称不能为空")
private String name;
@NotBlank(message = "展板分类名称不能为空", groups = {Add.class, Update.class})
private String name;
@ApiModelProperty("展板版权方ID")
@TableField("board_copyright_owner_id")
@NotBlank(message = "展板版权方ID不能为空")
private String boardCopyrightOwnerId;
@TableField("copyright_owner_id")
@NotBlank(message = "展板版权方ID不能为空", groups = {Add.class, Update.class})
private String copyrightOwnerId;
@ApiModelProperty("展板分类ID")
@TableField("exhibition_board_cat_id")
@NotBlank(message = "展板分类ID不能为空")
private String exhibitionBoardCatId;
@NotBlank(message = "展板分类ID不能为空", groups = {Add.class, Update.class})
private String exhibitionBoardCatId;
@ApiModelProperty("展板图片URL")
@TableField("board_img_url")
@NotBlank(message = "展板图片URL不能为空")
private String boardImgUrl;
@NotBlank(message = "展板图片URL不能为空", groups = {Add.class, Update.class})
private String boardImgUrl;
@ApiModelProperty("展板二维码URL")
@TableField("board_qrcode_url")
@NotBlank(message = "展板二维码URL不能为空")
private String boardQrcodeUrl;
@NotBlank(message = "展板二维码URL不能为空", groups = {Add.class, Update.class})
private String boardQrcodeUrl;
@ApiModelProperty("简介")
@TableField("introduction")
@NotBlank(message = "简介不能为空")
private String introduction;
@ApiModelProperty("视频版权方ID")
@TableField("asset_copyright_owner_id")
private String assetCopyrightOwnerId;
@NotBlank(message = "简介不能为空", groups = {Add.class, Update.class})
private String introduction;
@ApiModelProperty("视频类别ID")
@TableField("asset_type")
private String assetType;
@ApiModelProperty("视频ID")
@TableField("asset_id")
private String assetId;
@ApiModelProperty("导览音频URL")
@TableField("guide_audio_url")
private String guideAudioUrl;
@ApiModelProperty("参考资料")
@TableField("reference_material")
private String referenceMaterial;
@ApiModelProperty("创建日期")
@TableField(value = "create_time", fill = FieldFill.INSERT)
private LocalDateTime createTime;
@ApiModelProperty("修改日期")
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
@ApiModelProperty("审核状态")
@TableField("audit_status")
private String auditStatus;
}
package cn.wisenergy.chnmuseum.party.model;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Add;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Update;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.*;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;
......@@ -15,37 +19,43 @@ import java.time.LocalDateTime;
* </p>
*
* @author Danny Lee
* @since 2021-03-16
* @since 2021-03-17
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@TableName("exhibition_board_cat")
@ApiModel(value = "ExhibitionBoardCat对象", description = "展板分类")
@ApiModel(value = "展板分类", description = "展板分类")
public class ExhibitionBoardCat implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.ASSIGN_ID)
@NotNull(message = "ID不能为空", groups = {Update.class})
private String id;
@ApiModelProperty(value = "展板分类名称")
@ApiModelProperty("展板分类名称")
@TableField("name")
@NotBlank(message = "展板分类名称不能为空", groups = {Add.class, Update.class})
private String name;
@ApiModelProperty(value = "所属版权方ID")
@ApiModelProperty("所属版权方ID")
@TableField("copyright_owner")
private String copyrightOwner;
@ApiModelProperty(value = "创建日期")
@ApiModelProperty("备注")
@TableField("remarks")
private String remarks;
@ApiModelProperty("创建日期")
@TableField(value = "create_time", fill = FieldFill.INSERT)
private LocalDateTime createTime;
@ApiModelProperty(value = "修改日期")
@ApiModelProperty("修改日期")
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
@ApiModelProperty(value = "备注")
@TableField("remarks")
private String remarks;
}
......@@ -47,7 +47,7 @@ import java.util.Map;
*/
@Slf4j
@RestController
@RequestMapping("/interface/asset")
@RequestMapping("/asset")
@Api(tags = {"视频操作接口"})
public class AssetController extends BaseController {
......@@ -188,11 +188,14 @@ public class AssetController extends BaseController {
Asset::getUpdateTime);
Page<Asset> page = this.assetService.page(getPage(), queryWrapper);
for (Asset asset : page.getRecords()) {
AssetType assetType = this.assetTypeService.getById(asset.getAssetTypeId());
asset.setAssetTypeName(assetType.getName());
CopyrightOwner copyrightOwner = this.copyrightOwnerService.getById(asset.getAssetCopyrightOwnerId());
asset.setAssetCopyrightOwnerName(copyrightOwner.getName());
if (asset.getAssetTypeId() != null) {
AssetType assetType = this.assetTypeService.getById(asset.getAssetTypeId());
asset.setAssetTypeName(assetType.getName());
}
if (asset.getAssetCopyrightOwnerId() != null) {
CopyrightOwner copyrightOwner = this.copyrightOwnerService.getById(asset.getAssetCopyrightOwnerId());
asset.setAssetCopyrightOwnerName(copyrightOwner.getName());
}
}
return getResult(page);
}
......@@ -205,12 +208,14 @@ public class AssetController extends BaseController {
@RequiresPermissions("asset:get:id")
public Map<String, Object> getById(@PathVariable("id") String id) {
Asset asset = assetService.getById(id);
AssetType assetType = this.assetTypeService.getById(asset.getAssetTypeId());
asset.setAssetTypeName(assetType.getName());
CopyrightOwner copyrightOwner = this.copyrightOwnerService.getById(asset.getAssetCopyrightOwnerId());
asset.setAssetCopyrightOwnerName(copyrightOwner.getName());
if (asset.getAssetTypeId() != null) {
AssetType assetType = this.assetTypeService.getById(asset.getAssetTypeId());
asset.setAssetTypeName(assetType.getName());
}
if (asset.getAssetCopyrightOwnerId() != null) {
CopyrightOwner copyrightOwner = this.copyrightOwnerService.getById(asset.getAssetCopyrightOwnerId());
asset.setAssetCopyrightOwnerName(copyrightOwner.getName());
}
return getResult(asset);
}
......
package cn.wisenergy.chnmuseum.party.web.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Add;
import cn.wisenergy.chnmuseum.party.common.vo.GenericPageParam;
import cn.wisenergy.chnmuseum.party.model.Asset;
import cn.wisenergy.chnmuseum.party.model.AssetType;
import cn.wisenergy.chnmuseum.party.service.AssetService;
import cn.wisenergy.chnmuseum.party.service.AssetTypeService;
import cn.wisenergy.chnmuseum.party.service.CopyrightOwnerService;
import cn.wisenergy.chnmuseum.party.web.controller.base.BaseController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* <p>
* <pre>
* 视频分类 前端控制器
* </p>
* </pre>
*
* @author Danny Lee
* @since 2021-03-16
* @since 2021-03-17
*/
@Slf4j
@RestController
@RequestMapping("/party/asset-type")
@RequestMapping("/assetType")
@Api(tags = {"视频分类操作接口"})
public class AssetTypeController extends BaseController {
@Resource
private AssetTypeService assetTypeService;
@Resource
private AssetService assetService;
@Resource
private CopyrightOwnerService copyrightOwnerService;
@PostMapping("/save")
@RequiresPermissions("asset:type:save")
@ApiOperation(value = "添加视频分类", notes = "添加视频分类")
public Map<String, Object> saveAssetType(@Validated(value = {Add.class}) AssetType assetType) {
// 保存业务节点信息
boolean result = assetTypeService.save(assetType);
// 返回操作结果
if (result) {
return getSuccessResult();
} else {
// 保存失败
return getFailResult();
}
}
@PutMapping("/update")
@RequiresPermissions("asset:type:update")
@ApiOperation(value = "修改视频分类信息", notes = "修改视频分类信息")
public Map<String, Object> updateAssetType(@Validated AssetType assetType) {
boolean flag = assetTypeService.updateById(assetType);
if (flag) {
return getSuccessResult();
}
return getFailResult();
}
@DeleteMapping("/delete/{id}")
@RequiresPermissions("asset:type:delete")
@ApiOperation(value = "根据ID删除视频分类", notes = "根据ID删除视频分类")
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "id", value = "标识ID", paramType = "path", dataType = "String")
})
public Map<String, Object> deleteAssetType(@PathVariable("id") String id) {
boolean result1 = assetTypeService.removeById(id);
// Asset entity = new Asset();
// entity.setAssetTypeId(null);
LambdaUpdateWrapper<Asset> updateWrapper = Wrappers.<Asset>lambdaUpdate().eq(Asset::getAssetTypeId, id);
updateWrapper.set(Asset::getAssetTypeId, null);
boolean result2 = this.assetService.update(updateWrapper);
if (result1 && result2) {
return getSuccessResult();
}
return getFailResult();
}
@GetMapping("/getList")
@RequiresPermissions("asset:type:list")
@ApiOperation(value = "获取视频分类全部列表(无分页)", notes = "获取视频分类全部列表(无分页)")
public Map<String, Object> getAssetTypeList() {
List<AssetType> assetTypeList = assetTypeService.list();
return getResult(assetTypeList);
}
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "_index", value = "分页起始偏移量", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "nameOrCode", value = "名称或编码", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "startDate", value = "创建时间-开始", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endDate", value = "创建时间-结束", paramType = "query", dataType = "String")
})
@PostMapping("/getPageList")
@RequiresPermissions("asset:type:page")
@ApiOperation(value = "获取视频分类分页列表", notes = "获取视频分类分页列表")
public Map<String, Object> getAssetTypePageList(GenericPageParam genericPageParam) {
LambdaQueryWrapper<AssetType> queryWrapper = new LambdaQueryWrapper<>();
// 对名称或编码模糊查询
if (StringUtils.isNotBlank(genericPageParam.getNameOrCode())) {
queryWrapper.like(AssetType::getName, genericPageParam.getNameOrCode());
}
// 根据创建时间区间检索
if (genericPageParam.getStartDate() != null && genericPageParam.getEndDate() != null) {
queryWrapper.ge(AssetType::getCreateTime, genericPageParam.getStartDate().atTime(0, 0, 0))
.le(AssetType::getCreateTime, genericPageParam.getEndDate().atTime(23, 59, 59));
}
// 设置排序规则
queryWrapper.orderByDesc(AssetType::getCreateTime);
// 设置查询内容
queryWrapper.select(
AssetType::getId,
AssetType::getName,
AssetType::getCreateTime,
AssetType::getUpdateTime);
Page<AssetType> page = this.assetTypeService.page(getPage(), queryWrapper);
for (AssetType assetType : page.getRecords()) {
}
return getResult(page);
}
@ApiOperation(value = "获取视频分类详情", notes = "获取视频分类详情")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "标识ID", dataType = "String", paramType = "path")
})
@GetMapping("/get/{id}")
@RequiresPermissions("asset:type:get:id")
public Map<String, Object> getById(@PathVariable("id") String id) {
AssetType assetType = assetTypeService.getById(id);
return getResult(assetType);
}
}
package cn.wisenergy.chnmuseum.party.web.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import cn.wisenergy.chnmuseum.party.common.enums.CopyrightOwnerTypeEnum;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Add;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Update;
import cn.wisenergy.chnmuseum.party.common.vo.GenericPageParam;
import cn.wisenergy.chnmuseum.party.model.Asset;
import cn.wisenergy.chnmuseum.party.model.CopyrightOwner;
import cn.wisenergy.chnmuseum.party.model.ExhibitionBoard;
import cn.wisenergy.chnmuseum.party.service.AssetService;
import cn.wisenergy.chnmuseum.party.service.CopyrightOwnerService;
import cn.wisenergy.chnmuseum.party.service.ExhibitionBoardService;
import cn.wisenergy.chnmuseum.party.web.controller.base.BaseController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* <p>
* <pre>
* 版权方 前端控制器
* </p>
* </pre>
*
* @author Danny Lee
* @since 2021-03-16
* @since 2021-03-17
*/
@Slf4j
@RestController
@RequestMapping("/party/copyright-owner")
@RequestMapping("/copyrightOwner")
@Api(tags = {"版权方操作接口"})
public class CopyrightOwnerController extends BaseController {
@Resource
private CopyrightOwnerService copyrightOwnerService;
@Resource
private AssetService assetService;
@Resource
private ExhibitionBoardService exhibitionBoardService;
@PostMapping("/save")
@RequiresPermissions("copyright:owner:save")
@ApiOperation(value = "添加版权方", notes = "添加版权方")
public Map<String, Object> saveCopyrightOwner(@Validated(value = {Add.class}) CopyrightOwner copyrightOwner, @RequestParam("copyrightOwnerType") CopyrightOwnerTypeEnum copyrightOwnerTypeEnum) {
copyrightOwner.setOwnerType(copyrightOwnerTypeEnum.name());
// 保存业务节点信息
boolean result = copyrightOwnerService.save(copyrightOwner);
// 返回操作结果
if (result) {
return getSuccessResult();
} else {
// 保存失败
return getFailResult();
}
}
@PutMapping("/update")
@RequiresPermissions("copyright:owner:update")
@ApiOperation(value = "修改版权方信息", notes = "修改版权方信息")
public Map<String, Object> updateCopyrightOwner(@Validated(value = {Update.class}) CopyrightOwner copyrightOwner, @RequestParam("copyrightOwnerType") CopyrightOwnerTypeEnum copyrightOwnerTypeEnum) {
copyrightOwner.setOwnerType(copyrightOwnerTypeEnum.name());
boolean flag = copyrightOwnerService.updateById(copyrightOwner);
if (flag) {
return getSuccessResult();
}
return getFailResult();
}
@DeleteMapping("/delete/{id}")
@RequiresPermissions("copyright:owner:delete")
@ApiOperation(value = "根据ID删除版权方", notes = "根据ID删除版权方")
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "id", value = "标识ID", paramType = "path", dataType = "String")
})
public Map<String, Object> deleteCopyrightOwner(@PathVariable("id") String id) {
boolean result = copyrightOwnerService.removeById(id);
LambdaUpdateWrapper<Asset> updateWrapper1 = Wrappers.<Asset>lambdaUpdate().eq(Asset::getAssetCopyrightOwnerId, id);
updateWrapper1.set(Asset::getAssetCopyrightOwnerId, null);
boolean result1 = this.assetService.update(updateWrapper1);
LambdaUpdateWrapper<ExhibitionBoard> updateWrapper = Wrappers.<ExhibitionBoard>lambdaUpdate().eq(ExhibitionBoard::getCopyrightOwnerId, id);
updateWrapper.set(ExhibitionBoard::getCopyrightOwnerId, null);
boolean result2 = this.exhibitionBoardService.update(updateWrapper);
if (result && result1 && result2) {
return getSuccessResult();
}
return getFailResult();
}
@GetMapping("/getList")
@RequiresPermissions("copyright:owner:list")
@ApiOperation(value = "获取版权方全部列表(无分页)", notes = "获取版权方全部列表(无分页)")
public Map<String, Object> getCopyrightOwnerList() {
List<CopyrightOwner> copyrightOwnerList = copyrightOwnerService.list(Wrappers.<CopyrightOwner>lambdaQuery());
return getResult(copyrightOwnerList);
}
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "_index", value = "分页起始偏移量", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "nameOrCode", value = "名称或编码", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "startDate", value = "创建时间-开始", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endDate", value = "创建时间-结束", paramType = "query", dataType = "String")
})
@PostMapping("/getPageList")
@RequiresPermissions("copyright:owner:page")
@ApiOperation(value = "获取版权方分页列表", notes = "获取版权方分页列表")
public Map<String, Object> getCopyrightOwnerPageList(GenericPageParam genericPageParam) {
LambdaQueryWrapper<CopyrightOwner> queryWrapper = new LambdaQueryWrapper<>();
// 对名称或编码模糊查询
if (StringUtils.isNotBlank(genericPageParam.getNameOrCode())) {
queryWrapper.like(CopyrightOwner::getName, genericPageParam.getNameOrCode());
}
// 根据创建时间区间检索
if (genericPageParam.getStartDate() != null && genericPageParam.getEndDate() != null) {
queryWrapper.ge(CopyrightOwner::getCreateTime, genericPageParam.getStartDate().atTime(0, 0, 0))
.le(CopyrightOwner::getCreateTime, genericPageParam.getEndDate().atTime(23, 59, 59));
}
// 设置排序规则
queryWrapper.orderByDesc(CopyrightOwner::getCreateTime);
// 设置查询内容
queryWrapper.select(
CopyrightOwner::getId,
CopyrightOwner::getName,
CopyrightOwner::getCreateTime,
CopyrightOwner::getUpdateTime);
Page<CopyrightOwner> page = this.copyrightOwnerService.page(getPage(), queryWrapper);
for (CopyrightOwner copyrightOwner : page.getRecords()) {
}
return getResult(page);
}
@ApiOperation(value = "获取版权方详情", notes = "获取版权方详情")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "标识ID", dataType = "String", paramType = "path")
})
@GetMapping("/get/{id}")
@RequiresPermissions("copyright:owner:get:id")
public Map<String, Object> getById(@PathVariable("id") String id) {
CopyrightOwner copyrightOwner = copyrightOwnerService.getById(id);
return getResult(copyrightOwner);
}
}
......@@ -4,16 +4,16 @@
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.wisenergy.chnmuseum.party.model.Asset">
<id column="id" property="id"/>
<result column="name" property="name"/>
<result column="asset_copyright_owner_id" property="assetCopyrightOwnerId"/>
<result column="asset_type_id" property="assetTypeId"/>
<result column="thumbnail" property="thumbnail"/>
<result column="video_url" property="videoUrl"/>
<result column="audit_status" property="auditStatus"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<id column="id" property="id" />
<result column="name" property="name" />
<result column="asset_copyright_owner_id" property="assetCopyrightOwnerId" />
<result column="asset_type_id" property="assetTypeId" />
<result column="thumbnail" property="thumbnail" />
<result column="video_url" property="videoUrl" />
<result column="audit_status" property="auditStatus" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
......
......@@ -4,13 +4,13 @@
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.wisenergy.chnmuseum.party.model.AssetType">
<id column="id" property="id"/>
<result column="name" property="name"/>
<result column="remarks" property="remarks"/>
<result column="copyright_owner_id" property="copyrightOwnerId"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<id column="id" property="id" />
<result column="name" property="name" />
<result column="remarks" property="remarks" />
<result column="copyright_owner_id" property="copyrightOwnerId" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
......
......@@ -4,13 +4,13 @@
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.wisenergy.chnmuseum.party.model.BoardTalking">
<id column="id" property="id"/>
<result column="board_id" property="boardId"/>
<result column="real_name" property="realName"/>
<result column="comment" property="comment"/>
<result column="asset" property="asset"/>
<result column="create_time" property="createTime"/>
</resultMap>
<id column="id" property="id" />
<result column="board_id" property="boardId" />
<result column="real_name" property="realName" />
<result column="comment" property="comment" />
<result column="asset" property="asset" />
<result column="create_time" property="createTime" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
......
......@@ -4,15 +4,15 @@
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.wisenergy.chnmuseum.party.model.CopyrightOwner">
<id column="id" property="id"/>
<result column="name" property="name"/>
<result column="owner_type" property="ownerType"/>
<result column="expire_date_start" property="expireDateStart"/>
<result column="expire_date_end" property="expireDateEnd"/>
<result column="remarks" property="remarks"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<id column="id" property="id" />
<result column="name" property="name" />
<result column="owner_type" property="ownerType" />
<result column="expire_date_start" property="expireDateStart" />
<result column="expire_date_end" property="expireDateEnd" />
<result column="remarks" property="remarks" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
......
......@@ -4,10 +4,10 @@
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.wisenergy.chnmuseum.party.model.CopytightOwnerAssetType">
<id column="id" property="id"/>
<result column="copyright_owner_id" property="copyrightOwnerId"/>
<result column="asset_type_id" property="assetTypeId"/>
</resultMap>
<id column="id" property="id" />
<result column="copyright_owner_id" property="copyrightOwnerId" />
<result column="asset_type_id" property="assetTypeId" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
......
......@@ -4,10 +4,10 @@
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.wisenergy.chnmuseum.party.model.CopytightOwnerBoardType">
<id column="id" property="id"/>
<result column="copyright_owner_id" property="copyrightOwnerId"/>
<result column="board_type_id" property="boardTypeId"/>
</resultMap>
<id column="id" property="id" />
<result column="copyright_owner_id" property="copyrightOwnerId" />
<result column="board_type_id" property="boardTypeId" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
......
......@@ -4,17 +4,17 @@
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.wisenergy.chnmuseum.party.model.ExhibitionBoardCat">
<id column="id" property="id"/>
<result column="name" property="name"/>
<result column="copyright_owner" property="copyrightOwner"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="remarks" property="remarks"/>
</resultMap>
<id column="id" property="id" />
<result column="name" property="name" />
<result column="copyright_owner" property="copyrightOwner" />
<result column="remarks" property="remarks" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, name, copyright_owner, create_time, update_time, remarks
id, name, copyright_owner, remarks, create_time, update_time
</sql>
</mapper>
......@@ -4,28 +4,25 @@
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.wisenergy.chnmuseum.party.model.ExhibitionBoard">
<id column="id" property="id"/>
<result column="name" property="name"/>
<result column="board_copyright_owner_id" property="boardCopyrightOwnerId"/>
<result column="exhibition_board_cat_id" property="exhibitionBoardCatId"/>
<result column="board_img_url" property="boardImgUrl"/>
<result column="board_qrcode_url" property="boardQrcodeUrl"/>
<result column="introduction" property="introduction"/>
<result column="asset_copyright_owner_id" property="assetCopyrightOwnerId"/>
<result column="asset_type" property="assetType"/>
<result column="asset_id" property="assetId"/>
<result column="guide_audio_url" property="guideAudioUrl"/>
<result column="reference_material" property="referenceMaterial"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="audit_status" property="auditStatus"/>
</resultMap>
<id column="id" property="id" />
<result column="name" property="name" />
<result column="copyright_owner_id" property="copyrightOwnerId" />
<result column="exhibition_board_cat_id" property="exhibitionBoardCatId" />
<result column="board_img_url" property="boardImgUrl" />
<result column="board_qrcode_url" property="boardQrcodeUrl" />
<result column="introduction" property="introduction" />
<result column="asset_type" property="assetType" />
<result column="asset_id" property="assetId" />
<result column="guide_audio_url" property="guideAudioUrl" />
<result column="reference_material" property="referenceMaterial" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<result column="audit_status" property="auditStatus" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, name, board_copyright_owner_id, exhibition_board_cat_id, board_img_url, board_qrcode_url, introduction,
asset_copyright_owner_id, asset_type, asset_id, guide_audio_url, reference_material, create_time, update_time,
audit_status
id, name, copyright_owner_id, exhibition_board_cat_id, board_img_url, board_qrcode_url, introduction, asset_type, asset_id, guide_audio_url, reference_material, create_time, update_time, audit_status
</sql>
</mapper>
......@@ -4,10 +4,10 @@
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.wisenergy.chnmuseum.party.model.LearningContentBoard">
<id column="id" property="id"/>
<result column="learning_content_id" property="learningContentId"/>
<result column="exhibition_board_id" property="exhibitionBoardId"/>
</resultMap>
<id column="id" property="id" />
<result column="learning_content_id" property="learningContentId" />
<result column="exhibition_board_id" property="exhibitionBoardId" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
......
......@@ -4,10 +4,10 @@
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.wisenergy.chnmuseum.party.model.LearningContentCopyrightOwner">
<id column="id" property="id"/>
<result column="learning_content_id" property="learningContentId"/>
<result column="copyright_owner_id" property="copyrightOwnerId"/>
</resultMap>
<id column="id" property="id" />
<result column="learning_content_id" property="learningContentId" />
<result column="copyright_owner_id" property="copyrightOwnerId" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
......
......@@ -4,14 +4,14 @@
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.wisenergy.chnmuseum.party.model.LearningContent">
<id column="id" property="id"/>
<result column="name" property="name"/>
<result column="avartar" property="avartar"/>
<result column="applicable_scope" property="applicableScope"/>
<result column="audit_status" property="auditStatus"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<id column="id" property="id" />
<result column="name" property="name" />
<result column="avartar" property="avartar" />
<result column="applicable_scope" property="applicableScope" />
<result column="audit_status" property="auditStatus" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
......
......@@ -4,13 +4,13 @@
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.wisenergy.chnmuseum.party.model.RunLog">
<id column="id" property="id"/>
<result column="mac_addr" property="macAddr"/>
<result column="organ_id" property="organId"/>
<result column="learning_content_id" property="learningContentId"/>
<result column="start_time" property="startTime"/>
<result column="end_time" property="endTime"/>
</resultMap>
<id column="id" property="id" />
<result column="mac_addr" property="macAddr" />
<result column="organ_id" property="organId" />
<result column="learning_content_id" property="learningContentId" />
<result column="start_time" property="startTime" />
<result column="end_time" property="endTime" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
......
......@@ -4,14 +4,14 @@
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.wisenergy.chnmuseum.party.model.SysLog">
<id column="id" property="id"/>
<result column="operator" property="operator"/>
<result column="operation_type" property="operationType"/>
<result column="operation_object" property="operationObject"/>
<result column="operation_content" property="operationContent"/>
<result column="operation_time" property="operationTime"/>
<result column="operation_ip" property="operationIp"/>
</resultMap>
<id column="id" property="id" />
<result column="operator" property="operator" />
<result column="operation_type" property="operationType" />
<result column="operation_object" property="operationObject" />
<result column="operation_content" property="operationContent" />
<result column="operation_time" property="operationTime" />
<result column="operation_ip" property="operationIp" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
......
......@@ -10,6 +10,7 @@ import ${package.Entity}.${entity};
import ${package.Service}.${table.serviceName};
import cn.wisenergy.chnmuseum.party.common.enums.AuditStatusEnum;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Add;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Update;
import cn.wisenergy.chnmuseum.party.common.vo.GenericPageParam;
#if(${swagger2})
......@@ -45,7 +46,7 @@ import java.util.Map;
#else
@Controller
#end
@RequestMapping("/interface/${table.entityPath}")
@RequestMapping("/${table.entityPath}")
@Api(tags = {"$!{table.comment}操作接口"})
#if(${kotlin})
class ${table.controllerName}#if(${superControllerClass}) : ${superControllerClass}()#end
......@@ -98,7 +99,7 @@ public class ${table.controllerName} {
@RequiresPermissions("$!{cfg.colonTableName}:update")
#end
@ApiOperation(value = "修改$!{table.comment}信息", notes = "修改$!{table.comment}信息")
public Map<String, Object> update${entity}(#if(${cfg.paramValidation})@Validated#end ${entity} ${cfg.entityObjectName}) {
public Map<String, Object> update${entity}(#if(${cfg.paramValidation})@Validated(value = {Update.class})#end ${entity} ${cfg.entityObjectName}) {
#if(${cfg.generatorStrategy} == 'ALL')
boolean flag = ${table.entityPath}Service.update${entity}(${cfg.entityObjectName});
#else
......
......@@ -87,7 +87,7 @@ public class ${entity} implements Serializable {
#elseif(!$null.isNull(${idType}) && "$!idType" != "")
## 设置主键注解
@TableId(value = "${field.name}", type = IdType.${idType})
@NotNull(message = "${field.propertyName}不能为空", groups = {Update.class})
@NotNull(message = "${field.comment}ID不能为空", groups = {Update.class})
## 是主键类型
#set($custom_is_pk=true)
#elseif(${field.convert})
......
......@@ -16,7 +16,7 @@
#end
#end
#foreach($field in ${table.commonFields})##生成公共字段
<result column="${field.name}" property="${field.propertyName}" />
<result column="${field.name}" property="${field.propertyName}" />
#end
#foreach($field in ${table.fields})
#if(!${field.keyFlag})##生成普通字段
......@@ -33,19 +33,5 @@
#end
${table.fieldNames}
</sql>
#if(${cfg.generatorStrategy})
<select id="get${entity}ById" resultType="${cfg.queryVoPath}">
select
<include refid="Base_Column_List"/>
from ${table.name} where ${cfg.pkIdColumnName} = #{id}
</select>
<select id="get${entity}PageList" resultType="${cfg.queryVoPath}">
select
<include refid="Base_Column_List"/>
from ${table.name}
</select>
#end
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment