Commit 983c494b by 郑永强

早晚报增加自有公众号

parent 4c80928b
...@@ -66,6 +66,15 @@ public interface AdNewsBiz { ...@@ -66,6 +66,15 @@ public interface AdNewsBiz {
Long addAdNewsWechat(AdNewsWechat adNewsWechat); Long addAdNewsWechat(AdNewsWechat adNewsWechat);
/** /**
* 获取自有公众号
* @param adviserId
* @param currentPage
* @param numPerPage
* @return
*/
PageBeanNew<AdNewsWechat> getAdNewsWechatListForAdviser(Long adviserId, Integer currentPage, Integer numPerPage);
/**
* 获取所有的公众号列表 * 获取所有的公众号列表
* @param currentPage * @param currentPage
* @param numPerPage * @param numPerPage
...@@ -124,4 +133,5 @@ public interface AdNewsBiz { ...@@ -124,4 +133,5 @@ public interface AdNewsBiz {
* @return * @return
*/ */
Long addAdNewsClickRecord(AdNewsClickRecord adNewsClickRecord); Long addAdNewsClickRecord(AdNewsClickRecord adNewsClickRecord);
} }
...@@ -18,6 +18,7 @@ import com.pcloud.book.group.dto.BookWxQrcodeDTO; ...@@ -18,6 +18,7 @@ import com.pcloud.book.group.dto.BookWxQrcodeDTO;
import com.pcloud.book.group.dto.GroupQrcodeFoAdDTO; import com.pcloud.book.group.dto.GroupQrcodeFoAdDTO;
import com.pcloud.book.group.vo.BookGroupClassifyVO; import com.pcloud.book.group.vo.BookGroupClassifyVO;
import com.pcloud.common.core.aspect.ParamLog; import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam; import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.DateUtils; import com.pcloud.common.utils.DateUtils;
...@@ -205,9 +206,9 @@ public class AdNewsBizImpl implements AdNewsBiz { ...@@ -205,9 +206,9 @@ public class AdNewsBizImpl implements AdNewsBiz {
// 需要发送的早晚报内容 // 需要发送的早晚报内容
List<String> contents = new ArrayList<>(); List<String> contents = new ArrayList<>();
// 插入发送记录 // 需要入库的发送记录
List<AdNewsGroupRecord> adNewsGroupRecords = new ArrayList<>(); List<AdNewsGroupRecord> adNewsGroupRecords = new ArrayList<>();
// 插入消息统计信息 // 需要入库的消息统计信息
List<AdNewsMessageStatistic> adNewsMessageStatistics = new ArrayList<>(); List<AdNewsMessageStatistic> adNewsMessageStatistics = new ArrayList<>();
// for循环内的临时变量 // for循环内的临时变量
...@@ -481,6 +482,7 @@ public class AdNewsBizImpl implements AdNewsBiz { ...@@ -481,6 +482,7 @@ public class AdNewsBizImpl implements AdNewsBiz {
map.put("hasBan", adNewsListParam.getHasBan()); map.put("hasBan", adNewsListParam.getHasBan());
map.put("hasUsed", adNewsListParam.getHasUsed()); map.put("hasUsed", adNewsListParam.getHasUsed());
map.put("adNewsWechatIds", adNewsListParam.getAdNewsWechatIds()); map.put("adNewsWechatIds", adNewsListParam.getAdNewsWechatIds());
map.put("contentFrom", adNewsListParam.getContentFrom());
PageBeanNew<AdNews> pageBeanNew = adNewsDao.listPageNew(pageParam, map, "getAdNewsList"); PageBeanNew<AdNews> pageBeanNew = adNewsDao.listPageNew(pageParam, map, "getAdNewsList");
return pageBeanNew; return pageBeanNew;
} }
...@@ -550,9 +552,32 @@ public class AdNewsBizImpl implements AdNewsBiz { ...@@ -550,9 +552,32 @@ public class AdNewsBizImpl implements AdNewsBiz {
@ParamLog("增加公众号反馈") @ParamLog("增加公众号反馈")
@Override @Override
public Long addAdNewsWechat(AdNewsWechat adNewsWechat) { public Long addAdNewsWechat(AdNewsWechat adNewsWechat) {
this.checkAdNewsWechat(adNewsWechat);
return adNewsWechatDao.insert(adNewsWechat); return adNewsWechatDao.insert(adNewsWechat);
} }
private void checkAdNewsWechat(AdNewsWechat adNewsWechat) {
if (adNewsWechat.getAdviserId() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "编辑id不能为空!");
}
if (StringUtil.isEmpty(adNewsWechat.getWechatName())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "公众号不能为空!");
}
if(adNewsWechatDao.checkRepeat(adNewsWechat.getWechatName(),adNewsWechat.getAdviserId()))
{
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "该公众号已经存在!");
}
}
@Override
@ParamLog("获取编辑自有公众号")
public PageBeanNew<AdNewsWechat> getAdNewsWechatListForAdviser(Long adviserId, Integer currentPage, Integer numPerPage) {
PageParam pageParam = new PageParam(currentPage, numPerPage);
Map<String, Object> map = new HashMap<>();
map.put("adviserId", adviserId);
return adNewsWechatDao.listPageNew(pageParam, map, "getAdNewsWechatListForAdviser");
}
@ParamLog("获取公众号列表") @ParamLog("获取公众号列表")
@Override @Override
public PageBeanNew<AdNewsWechat> getAdNewsWechatList(Integer currentPage, Integer numPerPage) { public PageBeanNew<AdNewsWechat> getAdNewsWechatList(Integer currentPage, Integer numPerPage) {
...@@ -587,7 +612,7 @@ public class AdNewsBizImpl implements AdNewsBiz { ...@@ -587,7 +612,7 @@ public class AdNewsBizImpl implements AdNewsBiz {
} }
// 移除编辑之前的选择 // 移除编辑之前的选择
adNewsWechatChooseDao.deleteAdNewsWechatChooseByPartyId(partyId); adNewsWechatChooseDao.deleteAdNewsWechatChooseByPartyId(partyId);
if(!ListUtils.isEmpty(adNewsWechatChooses)){ if (!ListUtils.isEmpty(adNewsWechatChooses)) {
// 重新建立关系 // 重新建立关系
adNewsWechatChooseDao.batchInsert(adNewsWechatChooses); adNewsWechatChooseDao.batchInsert(adNewsWechatChooses);
} }
......
...@@ -26,7 +26,9 @@ public class AdNewsCheck { ...@@ -26,7 +26,9 @@ public class AdNewsCheck {
if (ListUtils.isEmpty(adNewsSet.getAdNewsGroups())) { if (ListUtils.isEmpty(adNewsSet.getAdNewsGroups())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "发送群分类不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "发送群分类不能为空!");
} }
if (adNewsSet.getSendCount() == null || adNewsSet.getSendCount() <= 0) { // 勾选 系统公众号 或者 自有公众号 并且 推送条数小于0则提示;
if ((adNewsSet.getContentFrom() == AdContentFromEnum.WECHAT.key || adNewsSet.getContentFrom() == AdContentFromEnum.WECHAT_ADVISER.key)
&& (adNewsSet.getSendCount() == null || adNewsSet.getSendCount() <= 0)) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "推送条数不能为空且必须大于0!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "推送条数不能为空且必须大于0!");
} }
if (adNewsSet.getHasMorningOpen() == null) { if (adNewsSet.getHasMorningOpen() == null) {
...@@ -53,7 +55,9 @@ public class AdNewsCheck { ...@@ -53,7 +55,9 @@ public class AdNewsCheck {
if (adNewsSet.getHasEndContent() && StringUtil.isEmpty(adNewsSet.getEndContent())) { if (adNewsSet.getHasEndContent() && StringUtil.isEmpty(adNewsSet.getEndContent())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "结束语不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "结束语不能为空!");
} }
if (adNewsSet.getContentFrom() != AdContentFromEnum.WECHAT.key && adNewsSet.getContentFrom() != AdContentFromEnum.CUSTOM.key) { if (adNewsSet.getContentFrom() != AdContentFromEnum.WECHAT.key
&& adNewsSet.getContentFrom() != AdContentFromEnum.CUSTOM.key
&& adNewsSet.getContentFrom() != AdContentFromEnum.WECHAT_ADVISER.key) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "请选择早晚报内容来源!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "请选择早晚报内容来源!");
} }
for (AdNewsGroup adNewsGroup : adNewsSet.getAdNewsGroups()) { for (AdNewsGroup adNewsGroup : adNewsSet.getAdNewsGroups()) {
......
...@@ -9,4 +9,5 @@ import com.pcloud.common.core.dao.BaseDao; ...@@ -9,4 +9,5 @@ import com.pcloud.common.core.dao.BaseDao;
*/ */
public interface AdNewsWechatDao extends BaseDao<AdNewsWechat> { public interface AdNewsWechatDao extends BaseDao<AdNewsWechat> {
boolean checkRepeat(String wechatName, Long adviserId);
} }
...@@ -5,10 +5,20 @@ import com.pcloud.book.adnews.entity.AdNewsWechat; ...@@ -5,10 +5,20 @@ import com.pcloud.book.adnews.entity.AdNewsWechat;
import com.pcloud.common.core.dao.BaseDaoImpl; import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.HashMap;
import java.util.Map;
/** /**
* @author zhengyongqiang * @author zhengyongqiang
* @date 2019/8/7 11:52 * @date 2019/8/7 11:52
*/ */
@Repository("adNewsWechatDao") @Repository("adNewsWechatDao")
public class AdNewsWechatDaoImpl extends BaseDaoImpl<AdNewsWechat> implements AdNewsWechatDao { public class AdNewsWechatDaoImpl extends BaseDaoImpl<AdNewsWechat> implements AdNewsWechatDao {
@Override
public boolean checkRepeat(String wechatName, Long adviserId) {
Map<String,Object> map = new HashMap<>();
map.put("wechatName",wechatName);
map.put("adviserId",adviserId);
return super.getSqlSession().selectOne(getStatement("checkRepeat"),map);
}
} }
...@@ -30,6 +30,9 @@ public class AdNewsListParam { ...@@ -30,6 +30,9 @@ public class AdNewsListParam {
@ApiModelProperty ("公众号id") @ApiModelProperty ("公众号id")
private List<Long> adNewsWechatIds; private List<Long> adNewsWechatIds;
@ApiModelProperty(value = "公众号来源;", dataType = "com.pcloud.book.adnews.enums.AdContentFromEnum")
private Integer contentFrom;
@ApiModelProperty("已被禁用;0:没禁用; 1:已禁用;") @ApiModelProperty("已被禁用;0:没禁用; 1:已禁用;")
private Integer hasBan; private Integer hasBan;
......
...@@ -3,11 +3,13 @@ package com.pcloud.book.adnews.entity; ...@@ -3,11 +3,13 @@ package com.pcloud.book.adnews.entity;
import com.pcloud.common.entity.BaseEntity; import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/** /**
* @author zhengyongqiang * @author zhengyongqiang
* @date 2019/8/7 11:23 * @date 2019/8/7 11:23
*/ */
@Data
@ApiModel("新闻微信公众号") @ApiModel("新闻微信公众号")
public class AdNewsWechat extends BaseEntity { public class AdNewsWechat extends BaseEntity {
...@@ -34,52 +36,4 @@ public class AdNewsWechat extends BaseEntity { ...@@ -34,52 +36,4 @@ public class AdNewsWechat extends BaseEntity {
@ApiModelProperty("是否删除") @ApiModelProperty("是否删除")
private Boolean isDelete; private Boolean isDelete;
public static long getSerialVersionUID() {
return serialVersionUID;
}
public String getNewsFrom() {
return newsFrom;
}
public void setNewsFrom(String newsFrom) {
this.newsFrom = newsFrom;
}
public String getWechatName() {
return wechatName;
}
public void setWechatName(String wechatName) {
this.wechatName = wechatName;
}
public Long getAdviserId() {
return adviserId;
}
public void setAdviserId(Long adviserId) {
this.adviserId = adviserId;
}
public Boolean getDelete() {
return isDelete;
}
public void setDelete(Boolean delete) {
isDelete = delete;
}
@Override
public String toString() {
return "AdNewsWechat{" +
"newsFrom='" + newsFrom + '\'' +
", wechatName='" + wechatName + '\'' +
", adviserId=" + adviserId +
", isDelete=" + isDelete +
", createTime=" + createTime +
", updateTime=" + updateTime +
'}';
}
} }
...@@ -11,8 +11,9 @@ import org.springframework.amqp.rabbit.support.PublisherCallbackChannelImpl; ...@@ -11,8 +11,9 @@ import org.springframework.amqp.rabbit.support.PublisherCallbackChannelImpl;
*/ */
public enum AdContentFromEnum { public enum AdContentFromEnum {
WECHAT(0, "微信公众号"), WECHAT(0, "系统推荐公众号"),
CUSTOM(1, "自定义内容 "); CUSTOM(1, "自定义内容 "),
WECHAT_ADVISER(2,"自有公众号"); // 目前只使用于 ad_news_message_statistic.content_from
public final Integer key; public final Integer key;
......
...@@ -3,6 +3,7 @@ package com.pcloud.book.adnews.facade; ...@@ -3,6 +3,7 @@ package com.pcloud.book.adnews.facade;
import com.pcloud.book.adnews.entity.AdNewsClickRecord; import com.pcloud.book.adnews.entity.AdNewsClickRecord;
import com.pcloud.book.adnews.entity.AdNewsSet; import com.pcloud.book.adnews.entity.AdNewsSet;
import com.pcloud.book.adnews.dto.AdNewsListParam; import com.pcloud.book.adnews.dto.AdNewsListParam;
import com.pcloud.book.adnews.entity.AdNewsWechat;
import com.pcloud.common.dto.ResponseDto; import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.permission.PermissionException; import com.pcloud.common.permission.PermissionException;
...@@ -58,12 +59,12 @@ public interface AdNewsFacade { ...@@ -58,12 +59,12 @@ public interface AdNewsFacade {
ResponseDto<?> getAdNewsChooseList( ResponseDto<?> getAdNewsChooseList(
@RequestHeader("token") @ApiParam("token信息") String token, @RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam(value = "title", required = false) @ApiParam("标题") String title, @RequestParam(value = "title", required = false) @ApiParam("标题") String title,
@RequestParam(value = "hasUsed", required = false) @ApiParam("标题") Boolean hasUsed, @RequestParam(value = "hasUsed", required = false) @ApiParam("是否已使用") Boolean hasUsed,
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage, @RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage @RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException; ) throws BizException, PermissionException;
@ApiOperation("早晚报素材库") @ApiOperation("早晚报素材库管理(只获取编辑已选公众号的素材)")
@PostMapping("/getAdNewsList") @PostMapping("/getAdNewsList")
ResponseDto<?> getAdNewsList( ResponseDto<?> getAdNewsList(
@RequestHeader("token") @ApiParam("token信息") String token, @RequestHeader("token") @ApiParam("token信息") String token,
...@@ -78,6 +79,21 @@ public interface AdNewsFacade { ...@@ -78,6 +79,21 @@ public interface AdNewsFacade {
@RequestParam("hasBan") @ApiParam("禁止推送") Integer hasBan @RequestParam("hasBan") @ApiParam("禁止推送") Integer hasBan
) throws BizException, PermissionException; ) throws BizException, PermissionException;
@ApiOperation("编辑反馈公众号")
@PostMapping("/addAdNewsWechat")
ResponseDto<?> addAdNewsWechat(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestBody @ApiParam("AdNewsWechat") AdNewsWechat adNewsWechat
) throws BizException, PermissionException;
@ApiOperation("获取编辑自有公众号")
@GetMapping("/getAdNewsWechatList")
ResponseDto<?> getAdNewsWechatListForAdviser(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException;
@ApiOperation("添加编辑选择的公众号") @ApiOperation("添加编辑选择的公众号")
@PostMapping("/createAdNewsWechatChooseBatch") @PostMapping("/createAdNewsWechatChooseBatch")
ResponseDto<?> createAdNewsWechatChooseBatch( ResponseDto<?> createAdNewsWechatChooseBatch(
......
...@@ -171,6 +171,36 @@ public class AdNewsFacadeImpl implements AdNewsFacade { ...@@ -171,6 +171,36 @@ public class AdNewsFacadeImpl implements AdNewsFacade {
return new ResponseDto<>(); return new ResponseDto<>();
} }
@Override
@ApiOperation("编辑反馈公众号")
@PostMapping("/addAdNewsWechat")
public ResponseDto<?> addAdNewsWechat(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestBody @ApiParam("AdNewsWechat") AdNewsWechat adNewsWechat
) throws BizException, PermissionException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
adNewsWechat.setAdviserId(partyId);
return new ResponseDto<>(adNewsBiz.addAdNewsWechat(adNewsWechat));
}
@Override
@ApiOperation("获取编辑自有公众号")
@GetMapping("/getAdNewsWechatListForAdviser")
public ResponseDto<?> getAdNewsWechatListForAdviser(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (currentPage == null || currentPage < 0) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "当前页不能为空且不能小于0!");
}
if (numPerPage == null || numPerPage <= 0) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "每页条数不能为空且必须大于0!");
}
return new ResponseDto<>(adNewsBiz.getAdNewsWechatListForAdviser(partyId, currentPage, numPerPage));
}
@ApiOperation("添加编辑选择的公众号") @ApiOperation("添加编辑选择的公众号")
@PostMapping("/createAdNewsWechatChooseBatch") @PostMapping("/createAdNewsWechatChooseBatch")
@Override @Override
...@@ -277,7 +307,7 @@ public class AdNewsFacadeImpl implements AdNewsFacade { ...@@ -277,7 +307,7 @@ public class AdNewsFacadeImpl implements AdNewsFacade {
Long channelId = (Long) map.get(Cookie._CHANNEL_ID); Long channelId = (Long) map.get(Cookie._CHANNEL_ID);
Long wechatUserId = (Long) map.get(Cookie._WECHAT_USER_ID); Long wechatUserId = (Long) map.get(Cookie._WECHAT_USER_ID);
LOGGER.info("addAdNewsClickRecord Map => "+map.toString()); LOGGER.info("addAdNewsClickRecord Map => " + map.toString());
adNewsClickRecord.setWechatUserId(wechatUserId); adNewsClickRecord.setWechatUserId(wechatUserId);
return new ResponseDto<>(adNewsBiz.addAdNewsClickRecord(adNewsClickRecord)); return new ResponseDto<>(adNewsBiz.addAdNewsClickRecord(adNewsClickRecord));
......
...@@ -141,13 +141,20 @@ ...@@ -141,13 +141,20 @@
FROM FROM
ad_news a ad_news a
INNER JOIN ad_news_wechat b on a.news_from=b.news_from and b.is_delete=0 INNER JOIN ad_news_wechat b on a.news_from=b.news_from and b.is_delete=0
<if test="adNewsWechatIds != null and adNewsWechatIds.size()>0"> <choose>
AND b.id IN <when test="contentFrom != null and contentFrom == 2">
<foreach collection="adNewsWechatIds" item="item" index="i" separator="," open="(" close=")"> AND b.adviser_id=#{partyId}
${item} </when>
</foreach> <otherwise>
</if> <if test="adNewsWechatIds != null and adNewsWechatIds.size()>0">
INNER JOIN ad_news_wechat_choose c ON b.id=c.ad_news_wechat_id and c.create_user=#{partyId} and c.is_delete=0 AND b.id IN
<foreach collection="adNewsWechatIds" item="item" index="i" separator="," open="(" close=")">
${item}
</foreach>
</if>
INNER JOIN ad_news_wechat_choose c ON b.id=c.ad_news_wechat_id and c.create_user=#{partyId} and c.is_delete=0
</otherwise>
</choose>
where 1=1 where 1=1
<if test="title!=null"> <if test="title!=null">
AND a.title like concat('%', #{title},'%') AND a.title like concat('%', #{title},'%')
......
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.adnews.dao.impl.AdNewsWechatDaoImpl"> <mapper namespace="com.pcloud.book.adnews.dao.impl.AdNewsWechatDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.adnews.entity.AdNewsWechat"> <resultMap id="BaseResultMap" type="com.pcloud.book.adnews.entity.AdNewsWechat">
<id column="id" property="id" jdbcType="BIGINT"/> <id column="id" property="id" jdbcType="BIGINT"/>
...@@ -23,11 +23,25 @@ ...@@ -23,11 +23,25 @@
</select> </select>
<!--获取公众号列表--> <!--获取公众号列表-->
<select id="getAdNewsWechatList" parameterType="map" resultMap="BaseResultMap"> <select id=" getAdNewsWechatList" parameterType="map" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> select
from ad_news_wechat <include refid="Base_Column_List"/>
from ad_news_wechat
where where
news_from IS NOT NULL news_from IS NOT NULL
AND adviser_id IS NULL
AND is_delete=0
order by id desc
</select>
<!--获取编辑自有公众号-->
<select id="getAdNewsWechatListForAdviser" parameterType="map" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from ad_news_wechat
where
adviser_id=#{adviserId}
AND is_delete=0
order by id desc order by id desc
</select> </select>
...@@ -48,19 +62,28 @@ ...@@ -48,19 +62,28 @@
AND b.adviser_id = #{partyId} AND b.adviser_id = #{partyId}
WHERE WHERE
a.`news_from` IS NOT NULL a.`news_from` IS NOT NULL
AND a.adviser_id IS NULL
AND a.is_delete=0
</select>
<select id="checkRepeat" parameterType="map" resultType="boolean">
SELECT count(1) FROM ad_news_wechat
WHERE (wechat_name=#{wechatName} AND adviser_id IS NULL)
OR (wechat_name=#{wechatName} AND adviser_id=#{adviserId})
LIMIT 1
</select> </select>
<insert id="insert" parameterType="com.pcloud.book.adnews.entity.AdNewsWechat" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" parameterType="com.pcloud.book.adnews.entity.AdNewsWechat" useGeneratedKeys="true"
keyProperty="id">
insert into ad_news_wechat insert into ad_news_wechat
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
news_from, wechat_name, adviser_id, is_delete, create_time wechat_name, adviser_id, is_delete, create_time
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
#{newsFrom,jdbcType=VARCHAR},
#{wechatName,jdbcType=VARCHAR}, #{wechatName,jdbcType=VARCHAR},
#{adviserId,jdbcType=BIGINT}, #{adviserId,jdbcType=BIGINT},
#{isDelete,jdbcType=BOOLEAN}, 0,
NOW() NOW()
</trim> </trim>
</insert> </insert>
......
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