我的剧场接口

This commit is contained in:
kuang.yife 2024-03-18 11:28:27 +08:00
parent 772a01f31d
commit dc8f89d223
12 changed files with 730 additions and 0 deletions

View File

@ -0,0 +1,48 @@
package com.playlet.web.controller.app;
import com.github.pagehelper.PageInfo;
import com.playlet.common.core.controller.BaseController;
import com.playlet.common.core.domain.Result;
import com.playlet.system.domain.PlayletItemType;
import com.playlet.web.service.app.PlayletItemTypeAppService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Slf4j
@Api(tags = "短剧视频*剧场列表")
@RestController
@RequestMapping(value = "/app/type")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class PlayletItemTypeAppController extends BaseController {
private final PlayletItemTypeAppService playletItemTypeAppService;
/**
* 查询剧场分页列表
*/
@ResponseBody
@PostMapping("/getTypePage")
@ApiOperation(value = "分页查询剧场列表")
public Result<PageInfo<PlayletItemType>> getTypePage(@RequestBody PlayletItemType playletItemType,
@RequestParam(value = "pageNum")Integer pageNum,
@RequestParam(value = "pageSize")Integer pageSize) {
return Result.success(playletItemTypeAppService.getTypePage(playletItemType, pageNum, pageSize));
}
/**
* 查询剧场不分页列表
*/
@ResponseBody
@PostMapping("/getTypeList")
@ApiOperation(value = "不分页查询剧场列表")
public Result<List<PlayletItemType>> getTypeList(@RequestBody PlayletItemType playletItemType) {
return Result.success(playletItemTypeAppService.getTypeList(playletItemType));
}
}

View File

@ -0,0 +1,127 @@
package com.playlet.web.controller.system;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.playlet.common.annotation.Log;
import com.playlet.common.enums.BusinessType;
import com.playlet.system.domain.PlayletItemType;
import com.playlet.system.service.IPlayletItemTypeService;
import com.playlet.common.core.controller.BaseController;
import com.playlet.common.core.domain.AjaxResult;
import com.playlet.common.utils.poi.ExcelUtil;
import com.playlet.common.core.page.TableDataInfo;
/**
* 剧场列Controller
*
* @author ruoyi
* @date 2024-03-18
*/
@Controller
@RequestMapping("/system/playlet/type")
public class PlayletItemTypeController extends BaseController
{
private String prefix = "system/playlet/type";
@Autowired
private IPlayletItemTypeService playletItemTypeService;
@RequiresPermissions("playlet:type:view")
@GetMapping()
public String type()
{
return prefix + "/type";
}
/**
* 查询剧场列列表
*/
@RequiresPermissions("playlet:type:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(PlayletItemType playletItemType)
{
startPage();
List<PlayletItemType> list = playletItemTypeService.selectPlayletItemTypeList(playletItemType);
return getDataTable(list);
}
/**
* 导出剧场列列表
*/
@RequiresPermissions("playlet:type:export")
@Log(title = "剧场列", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(PlayletItemType playletItemType)
{
List<PlayletItemType> list = playletItemTypeService.selectPlayletItemTypeList(playletItemType);
ExcelUtil<PlayletItemType> util = new ExcelUtil<PlayletItemType>(PlayletItemType.class);
return util.exportExcel(list, "剧场列数据");
}
/**
* 新增剧场列
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存剧场列
*/
@RequiresPermissions("playlet:type:add")
@Log(title = "剧场列", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(PlayletItemType playletItemType)
{
return toAjax(playletItemTypeService.insertPlayletItemType(playletItemType));
}
/**
* 修改剧场列
*/
@RequiresPermissions("playlet:type:edit")
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap)
{
PlayletItemType playletItemType = playletItemTypeService.selectPlayletItemTypeById(id);
mmap.put("playletItemType", playletItemType);
return prefix + "/edit";
}
/**
* 修改保存剧场列
*/
@RequiresPermissions("playlet:type:edit")
@Log(title = "剧场列", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(PlayletItemType playletItemType)
{
return toAjax(playletItemTypeService.updatePlayletItemType(playletItemType));
}
/**
* 删除剧场列
*/
@RequiresPermissions("playlet:type:remove")
@Log(title = "剧场列", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(playletItemTypeService.deletePlayletItemTypeByIds(ids));
}
}

View File

@ -0,0 +1,15 @@
package com.playlet.web.service.app;
import com.github.pagehelper.PageInfo;
import com.playlet.system.domain.PlayletItemType;
import java.util.List;
public interface PlayletItemTypeAppService {
PageInfo<PlayletItemType> getTypePage(PlayletItemType playletItemType,
Integer pageNum, Integer pageSize);
List<PlayletItemType> getTypeList(PlayletItemType playletItemType);
}

View File

@ -0,0 +1,34 @@
package com.playlet.web.service.app.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.playlet.system.domain.PlayletItemType;
import com.playlet.system.service.IPlayletItemTypeService;
import com.playlet.web.service.app.PlayletItemTypeAppService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Slf4j
@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class PlayletItemTypeAppServiceImpl implements PlayletItemTypeAppService {
private final IPlayletItemTypeService iPlayletItemTypeService;
@Override
public PageInfo<PlayletItemType> getTypePage(PlayletItemType playletItemType, Integer pageNum, Integer pageSize) {
PageHelper.startPage(pageNum, pageSize);
List<PlayletItemType> list = iPlayletItemTypeService.selectPlayletItemTypeList(playletItemType);
return PageInfo.of(list);
}
@Override
public List<PlayletItemType> getTypeList(PlayletItemType playletItemType) {
return iPlayletItemTypeService.selectPlayletItemTypeList(playletItemType);
}
}

View File

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增剧场列')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-type-add">
<div class="form-group">
<label class="col-sm-3 control-label">剧场名称:</label>
<div class="col-sm-8">
<input name="name" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<textarea name="remark" class="form-control"></textarea>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "system/playlet/type"
$("#form-type-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-type-add').serialize());
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改剧场列')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-type-edit" th:object="${playletItemType}">
<input name="id" th:field="*{id}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">剧场名称:</label>
<div class="col-sm-8">
<input name="name" th:field="*{name}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<textarea name="remark" class="form-control">[[*{remark}]]</textarea>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "system/playlet/type";
$("#form-type-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-type-edit').serialize());
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,94 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('剧场列列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>剧场名称:</label>
<input type="text" name="name"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="playlet:type:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="playlet:type:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="playlet:type:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="playlet:type:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('playlet:type:edit')}]];
var removeFlag = [[${@permission.hasPermi('playlet:type:remove')}]];
var prefix = ctx + "system/playlet/type";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "剧场列",
columns: [{
checkbox: true
},
{
field: 'id',
title: '剧场id',
visible: false
},
{
field: 'name',
title: '剧场名称'
},
{
field: 'status',
title: '01.正常 02.删除'
},
{
field: 'remark',
title: '备注'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>

View File

@ -0,0 +1,33 @@
package com.playlet.system.domain;
import com.playlet.common.core.domain.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.playlet.common.annotation.Excel;
/**
* 剧场列对象 playlet_item_type
*
* @author ruoyi
* @date 2024-03-18
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName(value = "playlet_item_type")
public class PlayletItemType extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 剧场id */
private Long id;
/** 剧场名称 */
@Excel(name = "剧场名称")
private String name;
/** 01.正常 02.删除 */
@Excel(name = "01.正常 02.删除")
private String status;
}

View File

@ -0,0 +1,62 @@
package com.playlet.system.mapper;
import java.util.List;
import com.playlet.system.domain.PlayletItemType;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 剧场列Mapper接口
*
* @author ruoyi
* @date 2024-03-18
*/
public interface PlayletItemTypeMapper extends BaseMapper<PlayletItemType>
{
/**
* 查询剧场列
*
* @param id 剧场列主键
* @return 剧场列
*/
public PlayletItemType selectPlayletItemTypeById(Long id);
/**
* 查询剧场列列表
*
* @param playletItemType 剧场列
* @return 剧场列集合
*/
public List<PlayletItemType> selectPlayletItemTypeList(PlayletItemType playletItemType);
/**
* 新增剧场列
*
* @param playletItemType 剧场列
* @return 结果
*/
public int insertPlayletItemType(PlayletItemType playletItemType);
/**
* 修改剧场列
*
* @param playletItemType 剧场列
* @return 结果
*/
public int updatePlayletItemType(PlayletItemType playletItemType);
/**
* 删除剧场列
*
* @param id 剧场列主键
* @return 结果
*/
public int deletePlayletItemTypeById(Long id);
/**
* 批量删除剧场列
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deletePlayletItemTypeByIds(String[] ids);
}

View File

@ -0,0 +1,62 @@
package com.playlet.system.service;
import java.util.List;
import com.playlet.system.domain.PlayletItemType;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 剧场列Service接口
*
* @author ruoyi
* @date 2024-03-18
*/
public interface IPlayletItemTypeService extends IService<PlayletItemType>
{
/**
* 查询剧场列
*
* @param id 剧场列主键
* @return 剧场列
*/
public PlayletItemType selectPlayletItemTypeById(Long id);
/**
* 查询剧场列列表
*
* @param playletItemType 剧场列
* @return 剧场列集合
*/
public List<PlayletItemType> selectPlayletItemTypeList(PlayletItemType playletItemType);
/**
* 新增剧场列
*
* @param playletItemType 剧场列
* @return 结果
*/
public int insertPlayletItemType(PlayletItemType playletItemType);
/**
* 修改剧场列
*
* @param playletItemType 剧场列
* @return 结果
*/
public int updatePlayletItemType(PlayletItemType playletItemType);
/**
* 批量删除剧场列
*
* @param ids 需要删除的剧场列主键集合
* @return 结果
*/
public int deletePlayletItemTypeByIds(String ids);
/**
* 删除剧场列信息
*
* @param id 剧场列主键
* @return 结果
*/
public int deletePlayletItemTypeById(Long id);
}

View File

@ -0,0 +1,98 @@
package com.playlet.system.service.impl;
import java.util.List;
import com.playlet.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.playlet.system.mapper.PlayletItemTypeMapper;
import com.playlet.system.domain.PlayletItemType;
import com.playlet.system.service.IPlayletItemTypeService;
import com.playlet.common.core.text.Convert;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* 剧场列Service业务层处理
*
* @author ruoyi
* @date 2024-03-18
*/
@Service
public class PlayletItemTypeServiceImpl extends ServiceImpl<PlayletItemTypeMapper, PlayletItemType> implements IPlayletItemTypeService
{
@Autowired
private PlayletItemTypeMapper playletItemTypeMapper;
/**
* 查询剧场列
*
* @param id 剧场列主键
* @return 剧场列
*/
@Override
public PlayletItemType selectPlayletItemTypeById(Long id)
{
return playletItemTypeMapper.selectPlayletItemTypeById(id);
}
/**
* 查询剧场列列表
*
* @param playletItemType 剧场列
* @return 剧场列
*/
@Override
public List<PlayletItemType> selectPlayletItemTypeList(PlayletItemType playletItemType)
{
return playletItemTypeMapper.selectPlayletItemTypeList(playletItemType);
}
/**
* 新增剧场列
*
* @param playletItemType 剧场列
* @return 结果
*/
@Override
public int insertPlayletItemType(PlayletItemType playletItemType)
{
playletItemType.setCreateTime(DateUtils.getNowDate());
return playletItemTypeMapper.insertPlayletItemType(playletItemType);
}
/**
* 修改剧场列
*
* @param playletItemType 剧场列
* @return 结果
*/
@Override
public int updatePlayletItemType(PlayletItemType playletItemType)
{
playletItemType.setUpdateTime(DateUtils.getNowDate());
return playletItemTypeMapper.updatePlayletItemType(playletItemType);
}
/**
* 批量删除剧场列
*
* @param ids 需要删除的剧场列主键
* @return 结果
*/
@Override
public int deletePlayletItemTypeByIds(String ids)
{
return playletItemTypeMapper.deletePlayletItemTypeByIds(Convert.toStrArray(ids));
}
/**
* 删除剧场列信息
*
* @param id 剧场列主键
* @return 结果
*/
@Override
public int deletePlayletItemTypeById(Long id)
{
return playletItemTypeMapper.deletePlayletItemTypeById(id);
}
}

View File

@ -0,0 +1,82 @@
<?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.playlet.system.mapper.PlayletItemTypeMapper">
<resultMap type="PlayletItemType" id="PlayletItemTypeResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectPlayletItemTypeVo">
select id, name, status, create_by, create_time, update_by, update_time, remark from playlet_item_type
</sql>
<select id="selectPlayletItemTypeList" parameterType="PlayletItemType" resultMap="PlayletItemTypeResult">
<include refid="selectPlayletItemTypeVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
<select id="selectPlayletItemTypeById" parameterType="Long" resultMap="PlayletItemTypeResult">
<include refid="selectPlayletItemTypeVo"/>
where id = #{id}
</select>
<insert id="insertPlayletItemType" parameterType="PlayletItemType" useGeneratedKeys="true" keyProperty="id">
insert into playlet_item_type
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="status != null">status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updatePlayletItemType" parameterType="PlayletItemType">
update playlet_item_type
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="status != null">status = #{status},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deletePlayletItemTypeById" parameterType="Long">
delete from playlet_item_type where id = #{id}
</delete>
<delete id="deletePlayletItemTypeByIds" parameterType="String">
delete from playlet_item_type where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>