提交 bab214c4 authored 作者: luojie's avatar luojie

修改优惠券字段

上级 6bcf9a53
/*
package com.diaoyun.zion.chinafrica.controller;
import com.diaoyun.zion.chinafrica.entity.TbCfCommentsInfoEntity;
import com.diaoyun.zion.chinafrica.service.TbCfCommentsInfoService;
import com.diaoyun.zion.chinafrica.service.TbCfCommentsReplyService;
import com.diaoyun.zion.master.base.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.management.Query;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
*/
/**
* Controller
*
* @author lipengjun
* @date 2019-10-26 17:13:28
*//*
@Api(tags = "评论主表")
@RestController
@RequestMapping("/tbcfcommentsinfo")
public class TbCfCommentsController {
@Autowired
private TbCfCommentsInfoService tbCfCommentsInfoService;
@Autowired
private TbCfCommentsReplyService tbCfCommentsReplyService;
@PostMapping("/save")
@ApiOperation("保存评论")
@Transactional
public Result saveComments(@Valid TbCfCommentsInfo form, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
throw new CommentsException(ResultEnums.PARAMS_ERROR.getCode(), bindingResult.getFieldError().getDefaultMessage());
}
//将 CommentsInfoForm 里的数据拷贝到 CommentsInfo
CommentsInfo info = new CommentsInfo();
BeanUtils.copyProperties(form, info);
// 生成并设置评论的主键id
info.setId(KeyUtils.genUniqueKey());
CommentsInfo result = infoService.save(info);
if (result == null) {
throw new CommentsException(ResultEnums.SAVE_COMMENTS_FAIL);
}
return ResultVOUtils.success();
}
@GetMapping("/get/{ownerId}")
@ApiOperation("根据 ownerId 查询评论")
@ApiImplicitParam(name = "ownerId", value = "被评论者id")
public ResultVO getCommentsByOwnerId(@PathVariable("ownerId") String ownerId) {
List<CommentsInfo> infoList = infoService.findByOwnerId(ownerId);
//将 CommentsInfo 转换为 CommentsInfoDTO
List<CommentsInfoDTO> infoDTOS = infoList.stream().map(info -> {
CommentsInfoDTO dto = new CommentsInfoDTO();
BeanUtils.copyProperties(info, dto);
return dto;
}).collect(Collectors.toList());
return ResultVOUtils.success(infoDTOS);
}
@PostMapping("/save-reply")
@ApiOperation("保存评论回复")
@Transactional
public ResultVO saveReply(@Valid CommentsReplyForm form, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
throw new CommentsException(ResultEnums.PARAMS_ERROR.getCode(), bindingResult.getFieldError().getDefaultMessage());
}
CommentsReply reply = new CommentsReply();
BeanUtils.copyProperties(form, reply);
CommentsReply result = replyService.save(reply);
if (result == null) {
throw new CommentsException(ResultEnums.SAVE_COMMENTS_FAIL);
}
return ResultVOUtils.success();
}
@GetMapping("/get-reply/{commentId}")
@ApiOperation("通过commentId获取评论回复")
public ResultVO getReplyByCommentId(@PathVariable("commentId") String commentId) {
List<CommentsReply> replyList = replyService.findByCommentId(commentId);
//将 CommentsReply 转换为 CommentsReplyDTO
List<CommentsReplyDTO> replyDTOS = replyList.stream().map(reply -> {
CommentsReplyDTO dto = new CommentsReplyDTO();
BeanUtils.copyProperties(reply, dto);
return dto;
}).collect(Collectors.toList());
return ResultVOUtils.success(replyDTOS);
}
}*/
......@@ -37,7 +37,6 @@ public class TbCfCouponController {
public Result<TbCfCouponEntity> takeCoupon(@ApiParam("优惠券Id")@PathVariable("couponId")String couponId) {
return tbCfCouponService.takeCoupon(couponId);
}
@ApiOperation("获取用户所有优惠券")
@GetMapping
public Result<UserCouponVo> getUserCoupons() {
......@@ -49,7 +48,4 @@ public class TbCfCouponController {
public Result<TbCfCouponEntity> queryCouponDetail(@ApiParam("优惠券Id")@PathVariable("couponId")String couponId) {
return tbCfCouponService.queryCouponDetail(couponId);
}
}
package com.diaoyun.zion.chinafrica.dao;
import com.diaoyun.zion.chinafrica.entity.TbCfCommentsInfoEntity;
import com.diaoyun.zion.master.dao.BaseDao;
import org.springframework.stereotype.Service;
/**
* Dao
*
* @author lipengjun
* @date 2019-10-26 17:13:28
*/
@Service
public interface TbCfCommentsInfoDao extends BaseDao<TbCfCommentsInfoEntity> {
}
package com.diaoyun.zion.chinafrica.dao;
import com.diaoyun.zion.chinafrica.entity.TbCfCommentsReplyEntity;
import com.diaoyun.zion.master.dao.BaseDao;
import org.springframework.stereotype.Service;
/**
* Dao
*
* @author lipengjun
* @date 2019-10-26 17:13:28
*/
@Service
public interface TbCfCommentsReplyDao extends BaseDao<TbCfCommentsReplyEntity> {
}
......@@ -50,4 +50,6 @@ public interface TbCfCouponDao extends BaseDao<TbCfCouponEntity> {
* @return
*/
List<TbCfCouponEntity> getCouponByCategory(Integer couponCategory,Date nowTime);
String getCouponId();
}
package com.diaoyun.zion.chinafrica.entity;
import java.io.Serializable;
import java.util.Date;
/**
* 实体
* 表名 tb_cf_comments_info
*
* @author lipengjun
* @date 2019-10-26 17:13:28
*/
public class TbCfCommentsInfoEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 评论主键id
*/
private String commentId;
/**
* 被评论者id
*/
private String commentOwnerId;
/**
* 评论者id
*/
private String commentFromId;
/**
* 评论者名字
*/
private String commentFromName;
/**
* 评论者头像
*/
private String commentFromAvatar;
/**
* 点赞的数量
*/
private Integer likeNum;
/**
* 评论内容
*/
private String content;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
/**
* 设置:评论主键id
*/
public void setCommentId(String commentId) {
this.commentId = commentId;
}
/**
* 获取:评论主键id
*/
public String getCommentId() {
return commentId;
}
/**
* 设置:被评论者id
*/
public void setCommentOwnerId(String commentOwnerId) {
this.commentOwnerId = commentOwnerId;
}
/**
* 获取:被评论者id
*/
public String getCommentOwnerId() {
return commentOwnerId;
}
/**
* 设置:评论者id
*/
public void setCommentFromId(String commentFromId) {
this.commentFromId = commentFromId;
}
/**
* 获取:评论者id
*/
public String getCommentFromId() {
return commentFromId;
}
/**
* 设置:评论者名字
*/
public void setCommentFromName(String commentFromName) {
this.commentFromName = commentFromName;
}
/**
* 获取:评论者名字
*/
public String getCommentFromName() {
return commentFromName;
}
/**
* 设置:评论者头像
*/
public void setCommentFromAvatar(String commentFromAvatar) {
this.commentFromAvatar = commentFromAvatar;
}
/**
* 获取:评论者头像
*/
public String getCommentFromAvatar() {
return commentFromAvatar;
}
/**
* 设置:点赞的数量
*/
public void setLikeNum(Integer likeNum) {
this.likeNum = likeNum;
}
/**
* 获取:点赞的数量
*/
public Integer getLikeNum() {
return likeNum;
}
/**
* 设置:评论内容
*/
public void setContent(String content) {
this.content = content;
}
/**
* 获取:评论内容
*/
public String getContent() {
return content;
}
/**
* 设置:创建时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取:创建时间
*/
public Date getCreateTime() {
return createTime;
}
/**
* 设置:修改时间
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
/**
* 获取:修改时间
*/
public Date getUpdateTime() {
return updateTime;
}
}
package com.diaoyun.zion.chinafrica.entity;
import java.io.Serializable;
import java.util.Date;
/**
* 实体
* 表名 tb_cf_comments_reply
*
* @author lipengjun
* @date 2019-10-26 17:13:28
*/
public class TbCfCommentsReplyEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 评论子表id
*/
private String commentsId;
/**
* 评论主表id
*/
private String commentId;
/**
* 评论者id
*/
private String commentFromId;
/**
* 评论者名字
*/
private String commentFromName;
/**
* 评论者头像
*/
private String commentFromAvatar;
/**
* 被评论者id
*/
private String commentToId;
/**
* 被评论者名字
*/
private String commentToName;
/**
* 被评论者头像
*/
private String commentToAvatar;
/**
* 评论内容
*/
private String content;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
/**
* 设置:评论子表id
*/
public void setCommentsId(String commentsId) {
this.commentsId = commentsId;
}
/**
* 获取:评论子表id
*/
public String getCommentsId(String commentsId) {
return commentsId;
}
/**
* 设置:评论主表id
*/
public void setCommentId(String commentId) {
this.commentId = commentId;
}
/**
* 获取:评论主表id
*/
public String getCommentId() {
return commentId;
}
/**
* 设置:评论者id
*/
public void setCommentFromId(String commentFromId) {
this.commentFromId = commentFromId;
}
/**
* 获取:评论者id
*/
public String getCommentFromId() {
return commentFromId;
}
/**
* 设置:评论者名字
*/
public void setCommentFromName(String commentFromName) {
this.commentFromName = commentFromName;
}
/**
* 获取:评论者名字
*/
public String getCommentFromName() {
return commentFromName;
}
/**
* 设置:评论者头像
*/
public void setCommentFromAvatar(String commentFromAvatar) {
this.commentFromAvatar = commentFromAvatar;
}
/**
* 获取:评论者头像
*/
public String getCommentFromAvatar() {
return commentFromAvatar;
}
/**
* 设置:被评论者id
*/
public void setCommentToId(String commentToId) {
this.commentToId = commentToId;
}
/**
* 获取:被评论者id
*/
public String getCommentToId() {
return commentToId;
}
/**
* 设置:被评论者名字
*/
public void setCommentToName(String commentToName) {
this.commentToName = commentToName;
}
/**
* 获取:被评论者名字
*/
public String getCommentToName() {
return commentToName;
}
/**
* 设置:被评论者头像
*/
public void setCommentToAvatar(String commentToAvatar) {
this.commentToAvatar = commentToAvatar;
}
/**
* 获取:被评论者头像
*/
public String getCommentToAvatar() {
return commentToAvatar;
}
/**
* 设置:评论内容
*/
public void setContent(String content) {
this.content = content;
}
/**
* 获取:评论内容
*/
public String getContent() {
return content;
}
/**
* 设置:创建时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取:创建时间
*/
public Date getCreateTime() {
return createTime;
}
/**
* 设置:修改时间
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
/**
* 获取:修改时间
*/
public Date getUpdateTime() {
return updateTime;
}
}
......@@ -27,7 +27,12 @@ public class TbCfCouponEntity implements Serializable {
* 优惠券类型
*/
@ApiModelProperty("优惠券类型")
private Integer couponCategory;
private Integer couponCategoryId;
/**
* 优惠券类型
*/
@ApiModelProperty("优惠券类型名称")
private Integer couponCategoryName;
/**
* 可用于类目
*/
......@@ -135,16 +140,25 @@ public class TbCfCouponEntity implements Serializable {
/**
* 设置:优惠券类型
*/
public void setCouponCategory(Integer couponCategory) {
this.couponCategory = couponCategory;
public void setCouponCategoryId(Integer couponCategoryId) {
this.couponCategoryId = couponCategoryId;
}
/**
* 获取:优惠券类型
*/
public Integer getCouponCategory() {
return couponCategory;
public Integer getCouponCategoryId() {
return couponCategoryId;
}
public Integer getCouponCategoryName() {
return couponCategoryName;
}
public void setCouponCategoryName(Integer couponCategoryName) {
this.couponCategoryName = couponCategoryName;
}
/**
* 设置:可用于
*/
......
......@@ -97,6 +97,15 @@ public class TbCfUserInfoEntity implements Serializable {
* 邮箱验证 0未验证,1已验证
*/
private Integer emailFlag;
private String couponId;
public String getCouponId() {
return couponId;
}
public void setCouponId(String couponId) {
this.couponId = couponId;
}
/**
* 设置:用户id
......
package com.diaoyun.zion.chinafrica.service;
import com.diaoyun.zion.chinafrica.entity.TbCfCommentsInfoEntity;
import java.util.List;
/**
* Service接口
*
* @author lipengjun
* @date 2019-10-26 17:13:28
*/
public interface TbCfCommentsInfoService {
/**
* 根据主键删除
*
* @param commentId
* @return 删除条数
*/
int delete(String commentId);
/**
* 保存评论
* @return
*/
int save(TbCfCommentsInfoEntity tbCfCommentsInfo);
/**
* 根据被评论者的id查询评论列表
* @param ownerId
* @return
*/
List<TbCfCommentsInfoEntity> findByOwnerId(String ownerId);
}
package com.diaoyun.zion.chinafrica.service;
import com.diaoyun.zion.chinafrica.entity.TbCfCommentsReplyEntity;
import java.util.List;
import java.util.Map;
/**
* Service接口
*
* @author lipengjun
* @date 2019-10-26 17:13:28
*/
public interface TbCfCommentsReplyService {
/**
* 根据主键删除
*
* @param commentsId
* @return 删除条数
*/
int delete(String commentsId);
/**
* 保存评论回复
* @return
*/
int save(TbCfCommentsReplyEntity tbCfCommentsReply);
/**
* 根据评论id查询回复
* @return
*/
List<TbCfCommentsReplyEntity> findByCommentId(String commentsId);
}
package com.diaoyun.zion.chinafrica.service.impl;
import com.diaoyun.zion.chinafrica.dao.TbCfCommentsInfoDao;
import com.diaoyun.zion.chinafrica.entity.TbCfCommentsInfoEntity;
import com.diaoyun.zion.chinafrica.service.TbCfCommentsInfoService;
import com.diaoyun.zion.master.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Service实现类
*
* @author lipengjun
* @date 2019-10-26 17:13:28
*/
@Service("tbCfCommentsInfoService")
public class TbCfCommentsInfoServiceImpl implements TbCfCommentsInfoService {
@Autowired
private TbCfCommentsInfoDao tbCfCommentsInfoDao;
@Override
public int delete(String commentId) {
return tbCfCommentsInfoDao.delete(commentId);
}
@Override
public int save(TbCfCommentsInfoEntity tbCfCommentsInfo) {
tbCfCommentsInfo.setCommentId(IdUtil.createIdbyUUID());
return tbCfCommentsInfoDao.save(tbCfCommentsInfo);
}
@Override
public List<TbCfCommentsInfoEntity> findByOwnerId(String ownerId) {
return null;
}
}
package com.diaoyun.zion.chinafrica.service.impl;
import com.diaoyun.zion.chinafrica.dao.TbCfCommentsReplyDao;
import com.diaoyun.zion.chinafrica.entity.TbCfCommentsReplyEntity;
import com.diaoyun.zion.chinafrica.service.TbCfCommentsReplyService;
import com.diaoyun.zion.master.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* Service实现类
*
* @author lipengjun
* @date 2019-10-26 17:13:28
*/
@Service("tbCfCommentsReplyService")
public class TbCfCommentsReplyServiceImpl implements TbCfCommentsReplyService {
@Autowired
private TbCfCommentsReplyDao tbCfCommentsReplyDao;
@Override
public int delete(String commentsId) {
return tbCfCommentsReplyDao.delete(commentsId);
}
@Override
public int save(TbCfCommentsReplyEntity tbCfCommentsReply) {
tbCfCommentsReply.getCommentsId(IdUtil.createIdbyUUID());
return tbCfCommentsReplyDao.save(tbCfCommentsReply);
}
@Override
public List<TbCfCommentsReplyEntity> findByCommentId(String commentsId) {
return null;
}
}
......@@ -164,6 +164,8 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
result.setMessage(ResultCodeEnum.SUCCESS.getDesc());
result.setData(tbCfUserInfoVo);
//赠送用户优惠券
String couponId=tbCfCouponDao.getCouponId();
tbCfUserInfoVo.setCouponId(couponId);
//获取购物返券
List<TbCfCouponEntity> couponList = tbCfCouponDao.getCouponByCategory(CouponCategoryEnum.REGISTER.getValue(),new Date());
if(!couponList.isEmpty()) {
......@@ -422,8 +424,6 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
/**
* 第三方登录
*
* @param account
* @param nick
* @return
*/
/* private void loginByThirdPartyOfficial(String token, String ip, String account, String nick, Result result) {
......
......@@ -135,6 +135,16 @@ public class TbCfUserInfoVo implements Serializable {
@ApiModelProperty(value="用户token")
private String token;
@ApiModelProperty(value="优惠券id")
private String couponId;
public String getCouponId() {
return couponId;
}
public void setCouponId(String couponId) {
this.couponId = couponId;
}
/**
* 设置:用户id
......@@ -143,6 +153,7 @@ public class TbCfUserInfoVo implements Serializable {
this.userId = userId;
}
/**
* 获取:用户id
*/
......
<?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.platform.dao.TbCfCommentsInfoDao">
<resultMap type="com.platform.entity.TbCfCommentsInfoEntity" id="tbCfCommentsInfoMap">
<result property="commentId" column="comment_id"/>
<result property="commentOwnerId" column="comment_owner_id"/>
<result property="commentFromId" column="comment_from_id"/>
<result property="commentFromName" column="comment_from_name"/>
<result property="commentFromAvatar" column="comment_from_avatar"/>
<result property="likeNum" column="like_num"/>
<result property="content" column="content"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<select id="queryObject" resultType="com.platform.entity.TbCfCommentsInfoEntity">
select
`comment_id`,
`comment_owner_id`,
`comment_from_id`,
`comment_from_name`,
`comment_from_avatar`,
`like_num`,
`content`,
`create_time`,
`update_time`
from tb_cf_comments_info
where comment_id = #{id}
</select>
<select id="queryList" resultType="com.platform.entity.TbCfCommentsInfoEntity">
select
`comment_id`,
`comment_owner_id`,
`comment_from_id`,
`comment_from_name`,
`comment_from_avatar`,
`like_num`,
`content`,
`create_time`,
`update_time`
from tb_cf_comments_info
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
<choose>
<when test="sidx != null and sidx.trim() != ''">
order by ${sidx} ${order}
</when>
<otherwise>
order by comment_id desc
</otherwise>
</choose>
<if test="offset != null and limit != null">
limit #{offset}, #{limit}
</if>
</select>
<select id="queryTotal" resultType="int">
select count(*) from tb_cf_comments_info
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
</select>
<insert id="save" parameterType="com.platform.entity.TbCfCommentsInfoEntity">
insert into tb_cf_comments_info(
`comment_id`,
`comment_owner_id`,
`comment_from_id`,
`comment_from_name`,
`comment_from_avatar`,
`like_num`,
`content`,
`create_time`,
`update_time`)
values(
#{commentId},
#{commentOwnerId},
#{commentFromId},
#{commentFromName},
#{commentFromAvatar},
#{likeNum},
#{content},
#{createTime},
#{updateTime})
</insert>
<update id="update" parameterType="com.platform.entity.TbCfCommentsInfoEntity">
update tb_cf_comments_info
<set>
<if test="commentOwnerId != null">`comment_owner_id` = #{commentOwnerId}, </if>
<if test="commentFromId != null">`comment_from_id` = #{commentFromId}, </if>
<if test="commentFromName != null">`comment_from_name` = #{commentFromName}, </if>
<if test="commentFromAvatar != null">`comment_from_avatar` = #{commentFromAvatar}, </if>
<if test="likeNum != null">`like_num` = #{likeNum}, </if>
<if test="content != null">`content` = #{content}, </if>
<if test="createTime != null">`create_time` = #{createTime}, </if>
<if test="updateTime != null">`update_time` = #{updateTime}</if>
</set>
where comment_id = #{commentId}
</update>
<delete id="delete">
delete from tb_cf_comments_info where comment_id = #{value}
</delete>
<delete id="deleteBatch">
delete from tb_cf_comments_info where comment_id in
<foreach item="commentId" collection="array" open="(" separator="," close=")">
#{commentId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
<?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.platform.dao.TbCfCommentsReplyDao">
<resultMap type="com.platform.entity.TbCfCommentsReplyEntity" id="tbCfCommentsReplyMap">
<result property="commentsId" column="comments_id"/>
<result property="commentId" column="comment_id"/>
<result property="commentFromId" column="comment_from_id"/>
<result property="commentFromName" column="comment_from_name"/>
<result property="commentFromAvatar" column="comment_from_avatar"/>
<result property="commentToId" column="comment_to_id"/>
<result property="commentToName" column="comment_to_name"/>
<result property="commentToAvatar" column="comment_to_avatar"/>
<result property="content" column="content"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<select id="queryObject" resultType="com.platform.entity.TbCfCommentsReplyEntity">
select
`comments_id`,
`comment_id`,
`comment_from_id`,
`comment_from_name`,
`comment_from_avatar`,
`comment_to_id`,
`comment_to_name`,
`comment_to_avatar`,
`content`,
`create_time`,
`update_time`
from tb_cf_comments_reply
where comments_id = #{id}
</select>
<select id="queryList" resultType="com.platform.entity.TbCfCommentsReplyEntity">
select
`comments_id`,
`comment_id`,
`comment_from_id`,
`comment_from_name`,
`comment_from_avatar`,
`comment_to_id`,
`comment_to_name`,
`comment_to_avatar`,
`content`,
`create_time`,
`update_time`
from tb_cf_comments_reply
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
<choose>
<when test="sidx != null and sidx.trim() != ''">
order by ${sidx} ${order}
</when>
<otherwise>
order by comments_id desc
</otherwise>
</choose>
<if test="offset != null and limit != null">
limit #{offset}, #{limit}
</if>
</select>
<select id="queryTotal" resultType="int">
select count(*) from tb_cf_comments_reply
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
</select>
<insert id="save" parameterType="com.platform.entity.TbCfCommentsReplyEntity">
insert into tb_cf_comments_reply(
`comments_id`,
`comment_id`,
`comment_from_id`,
`comment_from_name`,
`comment_from_avatar`,
`comment_to_id`,
`comment_to_name`,
`comment_to_avatar`,
`content`,
`create_time`,
`update_time`)
values(
#{commentsId},
#{commentId},
#{commentFromId},
#{commentFromName},
#{commentFromAvatar},
#{commentToId},
#{commentToName},
#{commentToAvatar},
#{content},
#{createTime},
#{updateTime})
</insert>
<update id="update" parameterType="com.platform.entity.TbCfCommentsReplyEntity">
update tb_cf_comments_reply
<set>
<if test="commentId != null">`comment_id` = #{commentId}, </if>
<if test="commentFromId != null">`comment_from_id` = #{commentFromId}, </if>
<if test="commentFromName != null">`comment_from_name` = #{commentFromName}, </if>
<if test="commentFromAvatar != null">`comment_from_avatar` = #{commentFromAvatar}, </if>
<if test="commentToId != null">`comment_to_id` = #{commentToId}, </if>
<if test="commentToName != null">`comment_to_name` = #{commentToName}, </if>
<if test="commentToAvatar != null">`comment_to_avatar` = #{commentToAvatar}, </if>
<if test="content != null">`content` = #{content}, </if>
<if test="createTime != null">`create_time` = #{createTime}, </if>
<if test="updateTime != null">`update_time` = #{updateTime}</if>
</set>
where comments_id = #{commentsId}
</update>
<delete id="delete">
delete from tb_cf_comments_reply where comments_id = #{value}
</delete>
<delete id="deleteBatch">
delete from tb_cf_comments_reply where comments_id in
<foreach item="commentsId" collection="array" open="(" separator="," close=")">
#{commentsId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
......@@ -5,7 +5,7 @@
<resultMap type="com.diaoyun.zion.chinafrica.entity.TbCfCouponEntity" id="tbCfCouponMap">
<result property="couponId" column="coupon_id"/>
<result property="couponCategory" column="coupon_category"/>
<result property="couponCategoryId" column="coupon_category_name"/>
<result property="couponUse" column="coupon_use"/>
<result property="couponTitle" column="coupon_title"/>
<result property="couponIcon" column="coupon_icon"/>
......@@ -29,7 +29,8 @@
<select id="queryObject" resultType="com.diaoyun.zion.chinafrica.entity.TbCfCouponEntity">
select
`coupon_id`,
`coupon_category`,
b.coupon_category_id,
b.coupon_category_name,
`coupon_use`,
`coupon_title`,
`coupon_icon`,
......@@ -48,33 +49,34 @@
`create_time`,
`update_user_id`,
`update_time`
from tb_cf_coupon
from tb_cf_coupon a left join tb_cf_coupon_category b on a.coupon_category_id = b.coupon_category_id
where coupon_id = #{id}
</select>
<select id="queryList" resultType="com.diaoyun.zion.chinafrica.entity.TbCfCouponEntity">
select
`coupon_id`,
`coupon_category`,
`coupon_use`,
`coupon_title`,
`coupon_icon`,
`with_station_id`,
`with_amount`,
`deduct_amount`,
`quato`,
`take_count`,
`used_count`,
`start_time`,
`end_time`,
`valid_start_time`,
`valid_end_time`,
`status`,
`create_user_id`,
`create_time`,
`update_user_id`,
`update_time`
from tb_cf_coupon
`coupon_id`,
b.coupon_category_id,
b.coupon_category_name,
`coupon_use`,
`coupon_title`,
`coupon_icon`,
`with_station_id`,
`with_amount`,
`deduct_amount`,
`quato`,
`take_count`,
`used_count`,
`start_time`,
`end_time`,
`valid_start_time`,
`valid_end_time`,
`status`,
`create_user_id`,
`create_time`,
`update_user_id`,
`update_time`
from tb_cf_coupon a left join tb_cf_coupon_category b on a.coupon_category_id = b.coupon_category_id
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
......@@ -91,7 +93,7 @@
limit #{offset}, #{limit}
</if>
</select>
<select id="queryTotal" resultType="int">
select count(*) from tb_cf_coupon
WHERE 1=1
......@@ -99,11 +101,11 @@
AND name LIKE concat('%',#{name},'%')
</if>
</select>
<insert id="save" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfCouponEntity">
insert into tb_cf_coupon(
`coupon_id`,
`coupon_category`,
`coupon_category_id`,
`coupon_use`,
`coupon_title`,
`coupon_icon`,
......@@ -124,7 +126,7 @@
`update_time`)
values(
#{couponId},
#{couponCategory},
#{couponCategoryId},
#{couponUse},
#{couponTitle},
#{couponIcon},
......@@ -144,11 +146,11 @@
#{updateUserId},
#{updateTime})
</insert>
<update id="update" parameterType="com.diaoyun.zion.chinafrica.entity.TbCfCouponEntity">
update tb_cf_coupon
update tb_cf_coupon
<set>
<if test="couponCategory != null">`coupon_category` = #{couponCategory}, </if>
<if test="couponCategoryId != null">`coupon_category_id` = #{couponCategoryId}, </if>
<if test="couponUse != null">`coupon_use` = #{couponUse}, </if>
<if test="couponTitle != null">`coupon_title` = #{couponTitle}, </if>
<if test="couponIcon != null">`coupon_icon` = #{couponIcon}, </if>
......@@ -170,22 +172,27 @@
</set>
where coupon_id = #{couponId}
</update>
<delete id="delete">
delete from tb_cf_coupon where coupon_id = #{value}
</delete>
<select id="getCouponId" resultType="com.diaoyun.zion.chinafrica.entity.TbCfCouponEntity">
select distinct coupon_id from tb_cf_issue_coupon where coupon_id='1087f4a682354843b145d36c27d2d90e'
</select>
<delete id="deleteBatch">
delete from tb_cf_coupon where coupon_id in
delete from tb_cf_coupon where coupon_id in
<foreach item="couponId" collection="array" open="(" separator="," close=")">
#{couponId}
</foreach>
</delete>
<!--查询用户所有有效的优惠券-->
<select id="queryUserAvailableCoupon" resultType="com.diaoyun.zion.chinafrica.entity.TbCfCouponEntity">
select t2.* from tb_cf_take_coupon t1,tb_cf_coupon t2 where t1.user_id=#{userId} and t1.coupon_id=t2.coupon_id
and <![CDATA[ t2.valid_start_time<=#{nowTime}]]> and <![CDATA[t2.valid_end_time>=#{nowTime}]]> and t2.status=1
and t1.enable_flag=1
select DISTINCT t2.* from tb_cf_take_coupon t1,tb_cf_coupon t2,tb_cf_issue_coupon t3 ,tb_cf_user_info t4
where
(t1.user_id=#{userId} or t3.user_id=#{userId} or t4.user_id=#{userId})
and t1.coupon_id=t2.coupon_id and t2.coupon_id=t3.coupon_id or t2.coupon_id=t4.coupon_id
and <![CDATA[ t2.valid_start_time<=#{nowTime}]]> and <![CDATA[t2.valid_end_time>=#{nowTime}]]> and t2.status=1
and t1.enable_flag=1 and t3.enable_flag=1
</select>
<!--更改优惠券统计-->
......@@ -195,18 +202,19 @@
<!--获取已使用的优惠券-->
<select id="queryUserUsedCoupon" resultType="com.diaoyun.zion.chinafrica.entity.TbCfCouponEntity">
select t2.* from tb_cf_take_coupon t1,tb_cf_coupon t2 where t1.user_id=#{userId} and t1.coupon_id=t2.coupon_id
and t1.enable_flag=0
select t2.* from tb_cf_take_coupon t1,tb_cf_coupon t2 ,tb_cf_issue_coupon t3 ,tb_cf_user_info t4
where (t1.user_id=#{userId} and t1.coupon_id=t2.coupon_id and t2.coupon_id=t3.coupon_id)
and t1.enable_flag=0 and t3.enable_flag=0
</select>
<!--获取已过期的优惠券-->
<select id="queryUserExpiredoupon" resultType="com.diaoyun.zion.chinafrica.entity.TbCfCouponEntity">
select t2.* from tb_cf_take_coupon t1,tb_cf_coupon t2 where t1.user_id=#{userId} and t1.coupon_id=t2.coupon_id
and <![CDATA[ t2.valid_end_time<#{nowTime}]]> and t1.enable_flag=1
select t2.* from tb_cf_take_coupon t1,tb_cf_coupon t2 ,tb_cf_issue_coupon t3 where t1.user_id=#{userId} and t1.coupon_id=t2.coupon_id and t1.coupon_id=t2.coupon_id and t2.coupon_id=t3.coupon_id
and <![CDATA[ t2.valid_end_time<#{nowTime}]]> and t1.enable_flag=1 and t3.enable_flag=1
</select>
<!--根据优惠券种类获取发放中的优惠券-->
<select id="getCouponByCategory" resultType="com.diaoyun.zion.chinafrica.entity.TbCfCouponEntity">
select * from tb_cf_coupon where coupon_category=#{couponCategory} and
select * from tb_cf_coupon where coupon_category=#{couponCategoryId} and
<![CDATA[ start_time<=#{nowTime}]]> and <![CDATA[end_time>=#{nowTime}]]> and status=1;
</select>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论