Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
73024993c8
|
@ -88,16 +88,40 @@ public class AppShipinquanController {
|
||||||
@PostMapping("/addDianzan")
|
@PostMapping("/addDianzan")
|
||||||
@ApiOperation("添加点赞信息")
|
@ApiOperation("添加点赞信息")
|
||||||
public Result addDianzan(@RequestBody BlShipinquanDianzan blShipinquanDianzan){
|
public Result addDianzan(@RequestBody BlShipinquanDianzan blShipinquanDianzan){
|
||||||
blShipinquanDianzan.setCreateTime(new Date());
|
if(StringUtils.isNotEmpty(blShipinquanDianzan.getShipinquanId()+"")){
|
||||||
dianzanService.save(blShipinquanDianzan);
|
blShipinquanDianzan.setCreateTime(new Date());
|
||||||
return Result.success();
|
dianzanService.save(blShipinquanDianzan);
|
||||||
|
|
||||||
|
BlShipinquan blShipinquan = service.getById(blShipinquanDianzan.getShipinquanId());
|
||||||
|
Integer dzs = blShipinquan.getDzs();
|
||||||
|
dzs++;
|
||||||
|
blShipinquan.setDzs(dzs);
|
||||||
|
service.updateById(blShipinquan);
|
||||||
|
return Result.success();
|
||||||
|
}else{
|
||||||
|
return Result.error("点赞失败");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/delDianzan")
|
@PostMapping("/delDianzan")
|
||||||
@ApiOperation("添加点赞信息")
|
@ApiOperation("添加点赞信息")
|
||||||
public Result delDianzan(@RequestBody BlShipinquanDianzan blShipinquanDianzan){
|
public Result delDianzan(@RequestBody BlShipinquanDianzan blShipinquanDianzan){
|
||||||
dianzanService.removeById(blShipinquanDianzan.getId());
|
if(StringUtils.isNotEmpty(blShipinquanDianzan.getShipinquanId()+"") && StringUtils.isNotEmpty(blShipinquanDianzan.getCreateBy()+"")){
|
||||||
return Result.success();
|
QueryWrapper<BlShipinquanDianzan> query = new QueryWrapper<BlShipinquanDianzan>();
|
||||||
|
query.eq("shipinquan_id",blShipinquanDianzan.getShipinquanId());
|
||||||
|
query.eq("create_by",blShipinquanDianzan.getCreateBy());
|
||||||
|
dianzanService.remove(query);
|
||||||
|
|
||||||
|
BlShipinquan blShipinquan = service.getById(blShipinquanDianzan.getShipinquanId());
|
||||||
|
Integer dzs = blShipinquan.getDzs();
|
||||||
|
dzs--;
|
||||||
|
blShipinquan.setDzs(dzs);
|
||||||
|
service.updateById(blShipinquan);
|
||||||
|
return Result.success();
|
||||||
|
}else{
|
||||||
|
return Result.error("点赞失败");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.sqx.modules.shipinquan.entity;
|
package com.sqx.modules.shipinquan.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
@ -29,5 +30,10 @@ public class BlShipinquan implements Serializable {
|
||||||
private int pls;//评论数
|
private int pls;//评论数
|
||||||
private int type;//类型(0视频,1图片目前都是视频,预留)
|
private int type;//类型(0视频,1图片目前都是视频,预留)
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String artificerImg;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String sfdz;//是否点赞(0未点赞 1点赞)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?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.sqx.modules.shipinquan.dao.BlShipinquanDao">
|
||||||
|
|
||||||
|
|
||||||
|
<select id="selectPage" resultType="com.sqx.modules.shipinquan.entity.BlShipinquan">
|
||||||
|
SELECT
|
||||||
|
a.*,
|
||||||
|
b.artificer_img AS artificerImg,
|
||||||
|
if(c.id is null,0,1) as sfdz
|
||||||
|
FROM
|
||||||
|
bl_shipinquan a
|
||||||
|
left join artificer b on a.create_by = b.user_id
|
||||||
|
left join bl_shipinquan_dianzan c on a.id = b.user_id
|
||||||
|
<where>
|
||||||
|
<if test="createBy!=null and createBy!=''">
|
||||||
|
and a.create_by = #{createBy}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue