解决短剧挂载问题
This commit is contained in:
parent
5ad553c5a5
commit
1518e5d1c9
|
|
@ -0,0 +1,50 @@
|
|||
package com.playlet.web.controller.app;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.playlet.common.core.domain.Result;
|
||||
import com.playlet.system.domain.PlayletUserItem;
|
||||
import com.playlet.web.service.app.PlayletUserItemAppService;
|
||||
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.*;
|
||||
|
||||
@Slf4j
|
||||
@Api(tags = "短剧视频*短剧用户推广")
|
||||
@RestController
|
||||
@RequestMapping(value = "/app/userItem")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class PlayletUserItemAppController {
|
||||
|
||||
private final PlayletUserItemAppService playletUserItemAppService;
|
||||
|
||||
@ResponseBody
|
||||
@PostMapping("/addUserItem")
|
||||
@ApiOperation(value = "新增用户推广短剧")
|
||||
public Result<String> addUserItem(@RequestBody PlayletUserItem playletUserItem){
|
||||
try {
|
||||
return Result.success(playletUserItemAppService.addUserItem(playletUserItem), "操作成功");
|
||||
}catch (Exception e){
|
||||
log.error("新增用户推广短剧,异常:{}", e.getMessage(), e);
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@PostMapping("/getUserItemPage")
|
||||
@ApiOperation(value = "分页查询我推广的短剧")
|
||||
public Result<PageInfo<PlayletUserItem>> getUserItemPage(@RequestBody PlayletUserItem playletUserItem,
|
||||
@RequestParam(value = "pageNum") Integer pageNum,
|
||||
@RequestParam(value = "pageSize") Integer pageSize){
|
||||
try {
|
||||
return Result.success(playletUserItemAppService.getUserItemPage(playletUserItem, pageNum, pageSize));
|
||||
}catch (Exception e){
|
||||
log.error("新增用户推广短剧,异常:{}", e.getMessage(), e);
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -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.PlayletUserItem;
|
||||
import com.playlet.system.service.IPlayletUserItemService;
|
||||
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-04-15
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/system/playlet/userItem")
|
||||
public class PlayletUserItemController extends BaseController
|
||||
{
|
||||
private String prefix = "system/playlet/userItem";
|
||||
|
||||
@Autowired
|
||||
private IPlayletUserItemService playletUserItemService;
|
||||
|
||||
@RequiresPermissions("playlet:userItem:view")
|
||||
@GetMapping()
|
||||
public String item()
|
||||
{
|
||||
return prefix + "/item";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户推广短剧列表
|
||||
*/
|
||||
@RequiresPermissions("playlet:userItem:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(PlayletUserItem playletUserItem)
|
||||
{
|
||||
startPage();
|
||||
List<PlayletUserItem> list = playletUserItemService.selectPlayletUserItemList(playletUserItem);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出用户推广短剧列表
|
||||
*/
|
||||
@RequiresPermissions("playlet:userItem:export")
|
||||
@Log(title = "用户推广短剧", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(PlayletUserItem playletUserItem)
|
||||
{
|
||||
List<PlayletUserItem> list = playletUserItemService.selectPlayletUserItemList(playletUserItem);
|
||||
ExcelUtil<PlayletUserItem> util = new ExcelUtil<PlayletUserItem>(PlayletUserItem.class);
|
||||
return util.exportExcel(list, "用户推广短剧数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户推广短剧
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add()
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存用户推广短剧
|
||||
*/
|
||||
@RequiresPermissions("playlet:userItem:add")
|
||||
@Log(title = "用户推广短剧", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(PlayletUserItem playletUserItem)
|
||||
{
|
||||
return toAjax(playletUserItemService.insertPlayletUserItem(playletUserItem));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户推广短剧
|
||||
*/
|
||||
@RequiresPermissions("playlet:userItem:edit")
|
||||
@GetMapping("/edit/{id}")
|
||||
public String edit(@PathVariable("id") Long id, ModelMap mmap)
|
||||
{
|
||||
PlayletUserItem playletUserItem = playletUserItemService.selectPlayletUserItemById(id);
|
||||
mmap.put("playletUserItem", playletUserItem);
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存用户推广短剧
|
||||
*/
|
||||
@RequiresPermissions("playlet:userItem:edit")
|
||||
@Log(title = "用户推广短剧", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(PlayletUserItem playletUserItem)
|
||||
{
|
||||
return toAjax(playletUserItemService.updatePlayletUserItem(playletUserItem));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户推广短剧
|
||||
*/
|
||||
@RequiresPermissions("playlet:userItem:remove")
|
||||
@Log(title = "用户推广短剧", businessType = BusinessType.DELETE)
|
||||
@PostMapping( "/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
return toAjax(playletUserItemService.deletePlayletUserItemByIds(ids));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.playlet.web.service.app;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.playlet.system.domain.PlayletUserItem;
|
||||
|
||||
public interface PlayletUserItemAppService {
|
||||
/**
|
||||
* @param playletUserItem 用户信息
|
||||
* @return 推广链接
|
||||
*/
|
||||
String addUserItem(PlayletUserItem playletUserItem);
|
||||
|
||||
/**
|
||||
* @param playletUserItem 短剧信息
|
||||
* @param pageNum 页数
|
||||
* @param pageSize 条数
|
||||
* @return 分页查询结果
|
||||
*/
|
||||
PageInfo<PlayletUserItem> getUserItemPage(PlayletUserItem playletUserItem, Integer pageNum, Integer pageSize);
|
||||
}
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
package com.playlet.web.service.app.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.crypto.digest.MD5;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.playlet.common.json.JSONObject;
|
||||
import com.playlet.common.utils.security.Md5Utils;
|
||||
import com.playlet.system.domain.PlayletItem;
|
||||
import com.playlet.system.domain.PlayletItemType;
|
||||
import com.playlet.system.domain.PlayletUserItem;
|
||||
import com.playlet.system.service.IPlayletItemService;
|
||||
import com.playlet.system.service.IPlayletItemTypeService;
|
||||
import com.playlet.system.service.IPlayletUserItemService;
|
||||
import com.playlet.web.service.app.PlayletUserItemAppService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class PlayletUserItemAppServiceImpl implements PlayletUserItemAppService {
|
||||
|
||||
private final IPlayletUserItemService iPlayletUserItemService;
|
||||
|
||||
private final IPlayletItemService iPlayletItemService;
|
||||
|
||||
private final IPlayletItemTypeService iPlayletItemTypeService;
|
||||
|
||||
@Override
|
||||
public String addUserItem(PlayletUserItem playletUserItem) {
|
||||
PlayletUserItem model = iPlayletUserItemService.lambdaQuery()
|
||||
.eq(PlayletUserItem::getPlayletItem, playletUserItem.getItemId())
|
||||
.eq(PlayletUserItem::getUserId, playletUserItem.getUserId())
|
||||
.one();
|
||||
if(model == null){
|
||||
playletUserItem.setCreateTime(new Date());
|
||||
iPlayletUserItemService.save(playletUserItem);
|
||||
model = playletUserItem;
|
||||
}
|
||||
JSONObject body = new JSONObject();
|
||||
body.put("clientId","1000123");
|
||||
body.put("channelId","34661");
|
||||
body.put("bookId","41000103084");
|
||||
body.put("chapterIdx","1");
|
||||
body.put("name","ai种草达人");
|
||||
body.put("mediaSource","dy");
|
||||
// 调用推广api返回链接
|
||||
String result = HttpUtil.post("https://video.wqxsw.com/api/channelapi/referralsave", body);
|
||||
log.info("请求返回内容为 : {}", result);
|
||||
return "等待返回实际推广链接";
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<PlayletUserItem> getUserItemPage(PlayletUserItem playletUserItem, Integer pageNum, Integer pageSize) {
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
List<PlayletUserItem> list = iPlayletUserItemService.selectPlayletUserItemList(playletUserItem);
|
||||
list.forEach(model->{
|
||||
PlayletItem item = iPlayletItemService.getById(model.getItemId());
|
||||
if(ObjectUtil.isNotNull(item.getItemType())){
|
||||
PlayletItemType itemType = iPlayletItemTypeService.selectPlayletItemTypeById(Long.valueOf(item.getItemType()));
|
||||
item.setItemTypeName(itemType.getName());
|
||||
}
|
||||
model.setPlayletItem(item);
|
||||
});
|
||||
return PageInfo.of(list);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String token = "zlwaiSrEM9KEbilu5f";
|
||||
String timestamp = String.valueOf((int)(System.currentTimeMillis()/1000));
|
||||
String clientId = "10005693";
|
||||
String channelId = "34662";
|
||||
String signKey = MD5.create().digestHex(clientId + token + timestamp);
|
||||
JSONObject body = new JSONObject();
|
||||
body.put("clientId", clientId);
|
||||
body.put("channelId", channelId);
|
||||
body.put("bookId","41000103084");
|
||||
body.put("chapterIdx","1");
|
||||
body.put("name","zhongcaodaren");
|
||||
body.put("mediaSource","ks");
|
||||
body.put("signKey", signKey);
|
||||
body.put("timestamp", timestamp);
|
||||
body.put("fromDrId", "69104793291");
|
||||
// 调用推广api返回链接
|
||||
String url = "https://video.wqxsw.com/api/channelapi/referralsave";
|
||||
Map<String, String> headerMap = new HashMap<>();
|
||||
headerMap.put("Content-Type", "application/json");
|
||||
HttpResponse result = HttpUtil.createPost(url).addHeaders(headerMap).body(com.alibaba.fastjson.JSONObject.toJSONString(body)).execute();
|
||||
// String result = HttpUtil.post("https://video.wqxsw.com/api/v1/channelapi/getminiqrcode", body);
|
||||
log.info("请求入参:{}, 地址:{}, 返回:{}", body, url, result.body());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package com.playlet.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.playlet.common.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.playlet.common.annotation.Excel;
|
||||
|
||||
/**
|
||||
* 用户推广短剧对象 playlet_user_item
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-04-15
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName(value = "playlet_user_item")
|
||||
@ApiModel(value = "推广短剧")
|
||||
public class PlayletUserItem extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/** 短剧id */
|
||||
@Excel(name = "短剧id")
|
||||
@ApiModelProperty(value = "短剧id")
|
||||
private Long itemId;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "短剧详情")
|
||||
private PlayletItem playletItem;
|
||||
|
||||
/** 用户id */
|
||||
@Excel(name = "用户id")
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Long userId;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
package com.playlet.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.playlet.system.domain.PlayletUserItem;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* 用户推广短剧Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-04-15
|
||||
*/
|
||||
public interface PlayletUserItemMapper extends BaseMapper<PlayletUserItem>
|
||||
{
|
||||
/**
|
||||
* 查询用户推广短剧
|
||||
*
|
||||
* @param id 用户推广短剧主键
|
||||
* @return 用户推广短剧
|
||||
*/
|
||||
public PlayletUserItem selectPlayletUserItemById(Long id);
|
||||
|
||||
/**
|
||||
* 查询用户推广短剧列表
|
||||
*
|
||||
* @param playletUserItem 用户推广短剧
|
||||
* @return 用户推广短剧集合
|
||||
*/
|
||||
public List<PlayletUserItem> selectPlayletUserItemList(PlayletUserItem playletUserItem);
|
||||
|
||||
/**
|
||||
* 新增用户推广短剧
|
||||
*
|
||||
* @param playletUserItem 用户推广短剧
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertPlayletUserItem(PlayletUserItem playletUserItem);
|
||||
|
||||
/**
|
||||
* 修改用户推广短剧
|
||||
*
|
||||
* @param playletUserItem 用户推广短剧
|
||||
* @return 结果
|
||||
*/
|
||||
public int updatePlayletUserItem(PlayletUserItem playletUserItem);
|
||||
|
||||
/**
|
||||
* 删除用户推广短剧
|
||||
*
|
||||
* @param id 用户推广短剧主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePlayletUserItemById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除用户推广短剧
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePlayletUserItemByIds(String[] ids);
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
package com.playlet.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.playlet.system.domain.PlayletUserItem;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* 用户推广短剧Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-04-15
|
||||
*/
|
||||
public interface IPlayletUserItemService extends IService<PlayletUserItem>
|
||||
{
|
||||
/**
|
||||
* 查询用户推广短剧
|
||||
*
|
||||
* @param id 用户推广短剧主键
|
||||
* @return 用户推广短剧
|
||||
*/
|
||||
public PlayletUserItem selectPlayletUserItemById(Long id);
|
||||
|
||||
/**
|
||||
* 查询用户推广短剧列表
|
||||
*
|
||||
* @param playletUserItem 用户推广短剧
|
||||
* @return 用户推广短剧集合
|
||||
*/
|
||||
public List<PlayletUserItem> selectPlayletUserItemList(PlayletUserItem playletUserItem);
|
||||
|
||||
/**
|
||||
* 新增用户推广短剧
|
||||
*
|
||||
* @param playletUserItem 用户推广短剧
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertPlayletUserItem(PlayletUserItem playletUserItem);
|
||||
|
||||
/**
|
||||
* 修改用户推广短剧
|
||||
*
|
||||
* @param playletUserItem 用户推广短剧
|
||||
* @return 结果
|
||||
*/
|
||||
public int updatePlayletUserItem(PlayletUserItem playletUserItem);
|
||||
|
||||
/**
|
||||
* 批量删除用户推广短剧
|
||||
*
|
||||
* @param ids 需要删除的用户推广短剧主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePlayletUserItemByIds(String ids);
|
||||
|
||||
/**
|
||||
* 删除用户推广短剧信息
|
||||
*
|
||||
* @param id 用户推广短剧主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePlayletUserItemById(Long id);
|
||||
}
|
||||
|
|
@ -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.PlayletUserItemMapper;
|
||||
import com.playlet.system.domain.PlayletUserItem;
|
||||
import com.playlet.system.service.IPlayletUserItemService;
|
||||
import com.playlet.common.core.text.Convert;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* 用户推广短剧Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-04-15
|
||||
*/
|
||||
@Service
|
||||
public class PlayletUserItemServiceImpl extends ServiceImpl<PlayletUserItemMapper, PlayletUserItem> implements IPlayletUserItemService
|
||||
{
|
||||
@Autowired
|
||||
private PlayletUserItemMapper playletUserItemMapper;
|
||||
|
||||
/**
|
||||
* 查询用户推广短剧
|
||||
*
|
||||
* @param id 用户推广短剧主键
|
||||
* @return 用户推广短剧
|
||||
*/
|
||||
@Override
|
||||
public PlayletUserItem selectPlayletUserItemById(Long id)
|
||||
{
|
||||
return playletUserItemMapper.selectPlayletUserItemById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户推广短剧列表
|
||||
*
|
||||
* @param playletUserItem 用户推广短剧
|
||||
* @return 用户推广短剧
|
||||
*/
|
||||
@Override
|
||||
public List<PlayletUserItem> selectPlayletUserItemList(PlayletUserItem playletUserItem)
|
||||
{
|
||||
return playletUserItemMapper.selectPlayletUserItemList(playletUserItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户推广短剧
|
||||
*
|
||||
* @param playletUserItem 用户推广短剧
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertPlayletUserItem(PlayletUserItem playletUserItem)
|
||||
{
|
||||
playletUserItem.setCreateTime(DateUtils.getNowDate());
|
||||
return playletUserItemMapper.insertPlayletUserItem(playletUserItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户推广短剧
|
||||
*
|
||||
* @param playletUserItem 用户推广短剧
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updatePlayletUserItem(PlayletUserItem playletUserItem)
|
||||
{
|
||||
playletUserItem.setUpdateTime(DateUtils.getNowDate());
|
||||
return playletUserItemMapper.updatePlayletUserItem(playletUserItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除用户推广短剧
|
||||
*
|
||||
* @param ids 需要删除的用户推广短剧主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePlayletUserItemByIds(String ids)
|
||||
{
|
||||
return playletUserItemMapper.deletePlayletUserItemByIds(Convert.toStrArray(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户推广短剧信息
|
||||
*
|
||||
* @param id 用户推广短剧主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePlayletUserItemById(Long id)
|
||||
{
|
||||
return playletUserItemMapper.deletePlayletUserItemById(id);
|
||||
}
|
||||
}
|
||||
|
|
@ -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.PlayletUserItemMapper">
|
||||
|
||||
<resultMap type="PlayletUserItem" id="PlayletUserItemResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="itemId" column="item_id" />
|
||||
<result property="userId" column="user_id" />
|
||||
<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="selectPlayletUserItemVo">
|
||||
select id, item_id, user_id, create_by, create_time, update_by, update_time, remark from playlet_user_item
|
||||
</sql>
|
||||
|
||||
<select id="selectPlayletUserItemList" parameterType="PlayletUserItem" resultMap="PlayletUserItemResult">
|
||||
<include refid="selectPlayletUserItemVo"/>
|
||||
<where>
|
||||
<if test="itemId != null "> and item_id = #{itemId}</if>
|
||||
<if test="userId != null "> and user_id = #{userId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectPlayletUserItemById" parameterType="Long" resultMap="PlayletUserItemResult">
|
||||
<include refid="selectPlayletUserItemVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertPlayletUserItem" parameterType="PlayletUserItem" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into playlet_user_item
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="itemId != null">item_id,</if>
|
||||
<if test="userId != null">user_id,</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="itemId != null">#{itemId},</if>
|
||||
<if test="userId != null">#{userId},</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="updatePlayletUserItem" parameterType="PlayletUserItem">
|
||||
update playlet_user_item
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="itemId != null">item_id = #{itemId},</if>
|
||||
<if test="userId != null">user_id = #{userId},</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="deletePlayletUserItemById" parameterType="Long">
|
||||
delete from playlet_user_item where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deletePlayletUserItemByIds" parameterType="String">
|
||||
delete from playlet_user_item where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue