Commit 419210bb by 吴博

feat: [1004140] 足迹优化

parent df864da4
......@@ -3,28 +3,35 @@ package com.pcloud.book.applet.enums;
public enum AppletRecordTypeEnum {
// 1资讯
NEWS(1),
NEWS(1, "资讯资源"),
//编辑群
ADVISER_GROUP(2),
ADVISER_GROUP(2, "社群"),
//模板群
MODEL_GROUP(3),
MODEL_GROUP(3, "社群"),
//第三方群
THIRD_GROUP(4),
THIRD_GROUP(4, "社群"),
//作品
PRODUCT(5),
PRODUCT(5, ""),
//应用
APP(6),
APP(6, ""),
//书刊
BOOK(7),
BOOK(7, "已读书籍"),
//好书推荐
BOOK_RECOMMEND(8),
BOOK_RECOMMEND(8, "好书推荐"),
//精选书单
BOOK_LIST(9),
BOOK_LIST(9, "精选书单"),
//企业微信客服
WX_WORK_TEACHER(10);
WX_WORK_TEACHER(10, "微信客服");
public Integer value;
public String desc;
AppletRecordTypeEnum(Integer value, String desc) {
this.value = value;
this.desc = desc;
}
AppletRecordTypeEnum(Integer value) {
this.value = value;
}
......
......@@ -5,7 +5,6 @@ import com.pcloud.book.applet.dto.AppletRecordDTO;
import com.pcloud.book.applet.entity.AppletRecord;
import com.pcloud.common.page.PageBeanNew;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -61,9 +60,10 @@ public interface AppletRecordBiz {
* @param queryName
* @param currentPage
* @param numPerPage
* @param typeName
* @return
*/
PageBeanNew<AppletRecordDTO> listAppletRecord(Long wechatUserId, String date, List<Integer> recordTypes, String queryName, Integer currentPage, Integer numPerPage);
PageBeanNew<AppletRecordDTO> listAppletRecord(Long wechatUserId, String date, List<Integer> recordTypes, String queryName, Integer currentPage, Integer numPerPage, String typeName);
List<String> listUnreachableDate(Long wechatUserId);
......@@ -80,4 +80,17 @@ public interface AppletRecordBiz {
Object handleAppletRecordTypeCode(Long lastAppletRecordId);
void stopHandleAppletRecordTypeCode();
/**
* 获取足迹目录
* @param wechatUserId
* @param date
* @return
*/
List<AppletRecordDTO> getAppletRecordCatalogue(Long wechatUserId, String date);
/**
* 手动处理应用作品和资讯的typeCode
*/
void HandleTypeCode();
}
......@@ -131,6 +131,10 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
@Transactional(rollbackFor = Exception.class)
public Long insert(AppletRecord appletRecord) {
insertCheck(appletRecord);
AppletRecordDTO appletRecordDTO = new AppletRecordDTO();
BeanUtils.copyProperties(appletRecord, appletRecordDTO);
fillTypeCode(Lists.newArrayList(appletRecordDTO));
BeanUtils.copyProperties(appletRecordDTO, appletRecord);
appletRecordDao.insert(appletRecord);
//判断日表是否有数据
AppletRecordDayServe appletRecordDayServe = new AppletRecordDayServe();
......@@ -197,12 +201,22 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
@Override
@ParamLog(value = "我的足迹", isAfterReturn = false)
public PageBeanNew<AppletRecordDTO> listAppletRecord(Long wechatUserId, String date, List<Integer> recordTypes, String queryName,
Integer currentPage, Integer numPerPage) {
Integer currentPage, Integer numPerPage, String typeName) {
Map<String, Object> paramMap = new HashMap<>();
if (!ListUtils.isEmpty(recordTypes) && !recordTypes.contains(AppletRecordTypeEnum.NEWS.value) && !recordTypes.contains(AppletRecordTypeEnum.PRODUCT.value)) {
typeName = null;
}
paramMap.put("wechatUserId", wechatUserId);
paramMap.put("recordTypes", recordTypes);
paramMap.put("queryName", queryName);
if (!ListUtils.isEmpty(recordTypes)) {
paramMap.put("recordTypes", recordTypes);
}
if (!StringUtil.isEmpty(queryName)) {
paramMap.put("queryName", queryName);
}
if (!StringUtil.isEmpty(typeName)) {
paramMap.put("typeName", typeName);
}
List<AppletRecordDTO> recordList = null;
PageBeanNew<AppletRecordDTO> listAppletRecord = new PageBeanNew<>();
Integer bookType = null;
......@@ -212,7 +226,9 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
bookType = YesOrNoNumEnum.NO.getValue();
} else {
//从天表中查
paramMap.put("date", date);
if (!StringUtil.isEmpty(date)) {
paramMap.put("date", date);
}
listAppletRecord = appletRecordDayServeDao.listPageNew(new PageParam(currentPage, numPerPage), paramMap, "listAppletRecord");
bookType = YesOrNoNumEnum.YES.getValue();
......@@ -242,7 +258,117 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
}
@Override
public void fillAppletRecord(List<AppletRecordDTO> recordList, Integer bookType) {
@ParamLog("获取足迹目录")
public List<AppletRecordDTO> getAppletRecordCatalogue(Long wechatUserId, String date) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("wechatUserId", wechatUserId);
List<AppletRecordDTO> appletRecordDTOS = null;
if (StringUtil.isEmpty(date)) {
//从总表中查
appletRecordDTOS = appletRecordServeDao.getAppletRecordCatalogue(paramMap);
} else {
//从天表中查
paramMap.put("date", date);
appletRecordDTOS = appletRecordDayServeDao.getAppletRecordCatalogue(paramMap);
}
Boolean isContinue = true;
if (!ListUtils.isEmpty(appletRecordDTOS)) {
Iterator<AppletRecordDTO> iterator = appletRecordDTOS.iterator();
while (iterator.hasNext()) {
AppletRecordDTO appletRecordDTO = iterator.next();
if (Objects.equals(AppletRecordTypeEnum.ADVISER_GROUP.value, appletRecordDTO.getRecordType()) ||
Objects.equals(AppletRecordTypeEnum.MODEL_GROUP.value, appletRecordDTO.getRecordType()) ||
Objects.equals(AppletRecordTypeEnum.THIRD_GROUP.value, appletRecordDTO.getRecordType())) {
if (isContinue) {
appletRecordDTO.setTypeName(AppletRecordTypeEnum.ADVISER_GROUP.desc);
isContinue = false;
}else {
iterator.remove();
}
} else if (Objects.equals(AppletRecordTypeEnum.BOOK.value, appletRecordDTO.getRecordType())) {
//填充书籍信息
appletRecordDTO.setTypeName(AppletRecordTypeEnum.BOOK.desc);
} else if (Objects.equals(AppletRecordTypeEnum.BOOK_RECOMMEND.value, appletRecordDTO.getRecordType())) {
//填充书单推荐信息
appletRecordDTO.setTypeName(AppletRecordTypeEnum.BOOK_RECOMMEND.desc);
} else if (Objects.equals(AppletRecordTypeEnum.BOOK_LIST.value, appletRecordDTO.getRecordType())) {
//填充精选书单信息
appletRecordDTO.setTypeName(AppletRecordTypeEnum.BOOK_LIST.desc);
} else if (Objects.equals(AppletRecordTypeEnum.WX_WORK_TEACHER.value, appletRecordDTO.getRecordType())) {
// 填充企业微信客服
appletRecordDTO.setTypeName(AppletRecordTypeEnum.WX_WORK_TEACHER.desc);
}
}
}
return ListUtils.isEmpty(appletRecordDTOS) ? new ArrayList<>() : appletRecordDTOS;
}
@Override
public void HandleTypeCode() {
LOGGER.info("手动处理应用作品和资讯的typeCode");
Map<String, Object> paramMap = new HashMap<>();
List<AppletRecordDTO> recordList = null;
PageBeanNew<AppletRecordDTO> listAppletRecord = new PageBeanNew<>();
List<Integer> recordTypes = Lists.newArrayList(1, 5,6);
paramMap.put("recordTypes", recordTypes);
Integer currentPage = 0;
Integer numPerPage = 100;
Integer pageCount = 0;
listAppletRecord = appletRecordServeDao.listPageNew(new PageParam(currentPage, numPerPage), paramMap, "listAppletRecord");
pageCount = listAppletRecord.getPageCount();
while (currentPage < pageCount) {
listAppletRecord = appletRecordServeDao.listPageNew(new PageParam(currentPage, numPerPage), paramMap, "listAppletRecord");
if (!ListUtils.isEmpty(listAppletRecord.getRecordList())) {
HandleTypeCode4List(listAppletRecord.getRecordList());
}
LOGGER.info("处理服务表数据currentPage:{}", currentPage);
++currentPage;
}
listAppletRecord = appletRecordDayServeDao.listPageNew(new PageParam(currentPage, numPerPage), paramMap, "listAppletRecord");
pageCount = listAppletRecord.getPageCount();
currentPage = 0;
while (currentPage < pageCount) {
listAppletRecord = appletRecordDayServeDao.listPageNew(new PageParam(currentPage, numPerPage), paramMap, "listAppletRecord");
if (!ListUtils.isEmpty(listAppletRecord.getRecordList())) {
HandleTypeCode4ListDay(listAppletRecord.getRecordList());
}
LOGGER.info("处理服务天表数据currentPage:{}", currentPage);
++currentPage;
}
}
private void HandleTypeCode4ListDay(List<AppletRecordDTO> recordList) {
fillTypeCode(recordList);
appletRecordDayServeDao.batchUpdate(recordList);
}
private void HandleTypeCode4List(List<AppletRecordDTO> recordList) {
fillTypeCode(recordList);
appletRecordServeDao.batchUpdate(recordList);
}
private void fillTypeCode(List<AppletRecordDTO> recordList) {
fillAppletRecord(recordList, YesOrNoNumEnum.YES.getValue());
recordList.stream().forEach(appletRecordDTO -> {
if (Objects.equals(AppletRecordTypeEnum.NEWS.value, appletRecordDTO.getRecordType()) && null != appletRecordDTO.getAppletNewsDTO()) {
//填充资讯信息
appletRecordDTO.setTypeName(appletRecordDTO.getAppletNewsDTO().getSource());
} else if (Objects.equals(AppletRecordTypeEnum.PRODUCT.value, appletRecordDTO.getRecordType()) && null != appletRecordDTO.getAppletAppOrProductDTO()) {
//填充作品信息
appletRecordDTO.setTypeCode(appletRecordDTO.getAppletAppOrProductDTO().getServeTypeCode());
appletRecordDTO.setTypeName(appletRecordDTO.getAppletAppOrProductDTO().getServeTypeName());
} else if (Objects.equals(AppletRecordTypeEnum.APP.value, appletRecordDTO.getRecordType()) && null != appletRecordDTO.getAppletAppOrProductDTO()) {
//填充应用信息
appletRecordDTO.setTypeCode(appletRecordDTO.getAppletAppOrProductDTO().getServeTypeCode());
appletRecordDTO.setTypeName(appletRecordDTO.getAppletAppOrProductDTO().getServeTypeName());
}
});
}
@Override
public void fillAppletRecord(List<AppletRecordDTO> recordList, Integer bookType) {
if (ListUtils.isEmpty(recordList)) {
return;
}
......
......@@ -27,4 +27,12 @@ public interface AppletRecordDayServeDao extends BaseDao<AppletRecordDayServe> {
AppletRecordDayServe getByTypeAndServeId(Long wechatUserId, Integer recordType, Long fromId, String today);
Map<Long, AppletUserBookcaseDTO> getBookMap(List<AppletRecordDTO> appletRecordDTOS4Book);
List<AppletRecordDTO> getAppletRecordCatalogue(Map<String, Object> paramMap);
/**
* 批量更新
* @param recordList
*/
void batchUpdate(List<AppletRecordDTO> recordList);
}
\ No newline at end of file
......@@ -19,4 +19,8 @@ public interface AppletRecordServeDao extends BaseDao<AppletRecordServe> {
AppletRecordServe getByTypeAndServeId(Long wechatUserId, Integer recordType, Long fromId);
Map<Long, AppletUserBookcaseDTO> getBookMap(List<AppletRecordDTO> appletRecordDTOS4Book);
List<AppletRecordDTO> getAppletRecordCatalogue(Map<String, Object> paramMap);
void batchUpdate(List<AppletRecordDTO> recordList);
}
\ No newline at end of file
......@@ -34,4 +34,14 @@ public class AppletRecordDayServeDaoImpl extends BaseDaoImpl<AppletRecordDayServ
public Map<Long, AppletUserBookcaseDTO> getBookMap(List<AppletRecordDTO> appletRecordDTOS4Book) {
return getSessionTemplate().selectMap(getStatement("getBookMap"), appletRecordDTOS4Book, "id");
}
@Override
public List<AppletRecordDTO> getAppletRecordCatalogue(Map<String, Object> paramMap) {
return getSessionTemplate().selectList(getStatement("getAppletRecordCatalogue"), paramMap);
}
@Override
public void batchUpdate(List<AppletRecordDTO> recordList) {
getSessionTemplate().update(getStatement("batchUpdate"), recordList);
}
}
\ No newline at end of file
......@@ -33,4 +33,14 @@ public class AppletRecordServeDaoImpl extends BaseDaoImpl<AppletRecordServe> imp
public Map<Long, AppletUserBookcaseDTO> getBookMap(List<AppletRecordDTO> appletRecordDTOS4Book) {
return getSessionTemplate().selectMap(getStatement("getBookMap"), appletRecordDTOS4Book, "id");
}
@Override
public List<AppletRecordDTO> getAppletRecordCatalogue(Map<String, Object> paramMap) {
return getSessionTemplate().selectList(getStatement("getAppletRecordCatalogue"), paramMap);
}
@Override
public void batchUpdate(List<AppletRecordDTO> recordList) {
getSessionTemplate().update(getStatement("batchUpdate"), recordList);
}
}
\ No newline at end of file
package com.pcloud.book.applet.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.pcloud.book.group.dto.WxWorkTeacherDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -8,6 +9,7 @@ import lombok.Data;
import java.util.Date;
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class AppletRecordDTO {
private Long id;
......@@ -88,4 +90,7 @@ public class AppletRecordDTO {
@ApiModelProperty("是否收藏")
private Integer isCollect;
@ApiModelProperty("应用、作品类型或资讯来源名称")
private String typeName;
}
......@@ -59,6 +59,9 @@ public class AppletRecord extends BaseEntity {
@ApiModelProperty("应用或作品的跳转链接")
private String linkUrl;
@ApiModelProperty("应用、作品类型")
@ApiModelProperty("应用、作品类型或资讯来源")
private String typeCode;
@ApiModelProperty("应用、作品类型或资讯来源名称")
private String typeName;
}
......@@ -59,4 +59,10 @@ public class AppletRecordDayServe extends BaseEntity {
@ApiModelProperty("是否删除 0 未删除 1删除")
private Integer isDelete;
@ApiModelProperty("应用、作品类型或资讯来源")
private String typeCode;
@ApiModelProperty("应用、作品类型或资讯来源名称")
private String typeName;
}
\ No newline at end of file
......@@ -59,4 +59,10 @@ public class AppletRecordServe extends BaseEntity {
@ApiModelProperty("是否删除 0 未删除 1删除")
private Integer isDelete;
@ApiModelProperty("应用、作品类型或资讯来源")
private String typeCode;
@ApiModelProperty("应用、作品类型或资讯来源名称")
private String typeName;
}
\ No newline at end of file
......@@ -89,7 +89,7 @@ public class AppletRecordFacade {
@RequestBody AppletRecordQueryVO appletRecordQueryVO) {
Long wechatUserId = Cookie.getId(userInfo,Cookie._WECHAT_USER_ID);
PageBeanNew<AppletRecordDTO> recordDTOPageBeanNew = appletRecordBiz.listAppletRecord(wechatUserId, appletRecordQueryVO.getDate(),
appletRecordQueryVO.getRecordTypes(), appletRecordQueryVO.getQueryName(), appletRecordQueryVO.getCurrentPage(), appletRecordQueryVO.getNumPerPage());
appletRecordQueryVO.getRecordTypes(), appletRecordQueryVO.getQueryName(), appletRecordQueryVO.getCurrentPage(), appletRecordQueryVO.getNumPerPage(), appletRecordQueryVO.getTypeName());
return new ResponseDto<>(recordDTOPageBeanNew);
}
......@@ -100,4 +100,22 @@ public class AppletRecordFacade {
return new ResponseDto<>(appletRecordBiz.listUnreachableDate(wechatUserId));
}
@ApiOperation("获取足迹目录")
@RequestMapping(value = "getAppletRecordCatalogue", method = RequestMethod.POST)
public ResponseDto<List<AppletRecordDTO>> getAppletRecordCatalogue(@CookieValue("userInfo") String userInfo,
@RequestBody AppletRecordQueryVO appletRecordQueryVO) {
Long wechatUserId = Cookie.getId(userInfo,Cookie._WECHAT_USER_ID);
List<AppletRecordDTO> appletRecordDTOS = appletRecordBiz.getAppletRecordCatalogue(wechatUserId, appletRecordQueryVO.getDate());
return new ResponseDto<>(appletRecordDTOS);
}
@ApiOperation("手动处理应用作品和资讯的typeCode")
@RequestMapping(value = "HandleTypeCode", method = RequestMethod.POST)
public ResponseDto<?> HandleTypeCode(@CookieValue("userInfo") String userInfo){
Long wechatUserId = Cookie.getId(userInfo,Cookie._WECHAT_USER_ID);
appletRecordBiz.HandleTypeCode();
return new ResponseDto<>();
}
}
\ No newline at end of file
package com.pcloud.book.applet.vo;
import com.pcloud.settlementcenter.record.dto.PartyRoleIncomeDto;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.Data;
......@@ -13,4 +14,8 @@ public class AppletRecordQueryVO {
private String date;
private List<Integer> recordTypes;
private String queryName;
@ApiModelProperty("应用、作品类型或资讯来源")
private String typeCode;
@ApiModelProperty("应用、作品类型或资讯来源名称")
private String typeName;
}
......@@ -71,7 +71,8 @@
create_time,
create_date,
is_delete,
link_url
link_url,
type_name
) VALUES (
#{wechatUserId, jdbcType=BIGINT},
#{recordType, jdbcType=BOOLEAN},
......@@ -86,7 +87,8 @@
now(),
DATE_FORMAT(now(),"%Y-%m-%d"),
0,
#{linkUrl}
#{linkUrl},
#{typeName}
)
</insert>
......
......@@ -17,10 +17,12 @@
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="create_date" property="createDate" jdbcType="DATE"/>
<result column="is_delete" property="isDelete" jdbcType="INTEGER"/>
<result column="type_code" property="typeCode" jdbcType="VARCHAR"/>
<result column="type_name" property="typeName" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
id, wechat_user_id, record_type, rights_setting_id, book_id, channel_id, adviser_id, from_id, from_name, link_url, account_setting_id, create_time, create_date, is_delete
id, wechat_user_id, record_type, rights_setting_id, book_id, channel_id, adviser_id, from_id, from_name, link_url, account_setting_id, create_time, create_date, is_delete, type_code, type_name
</sql>
<select id="getById" resultMap="BaseResultMap">
......@@ -49,7 +51,9 @@
link_url,
account_setting_id,
create_time,
create_date
create_date,
type_code,
type_name
) VALUES (
#{wechatUserId, jdbcType=BIGINT},
#{recordType, jdbcType=INTEGER},
......@@ -62,7 +66,9 @@
#{linkUrl, jdbcType=VARCHAR},
#{accountSettingId, jdbcType=BIGINT},
now(),
CURRENT_DATE()
CURRENT_DATE(),
#{typeCode},
#{typeName}
)
</insert>
......@@ -115,7 +121,9 @@
from_name = #{fromName},
link_url = #{linkUrl},
account_setting_id = #{accountSettingId},
create_time = now()
create_time = now(),
type_code = #{typeCode},
type_name = #{typeName}
</set>
WHERE id = #{id}
</update>
......@@ -150,10 +158,12 @@
`applet_record_day_serve`
WHERE
is_delete = 0
and
wechat_user_id = #{wechatUserId}
and
create_date = #{date}
<if test="wechatUserId != null">
and wechat_user_id = #{wechatUserId}
</if>
<if test="date != null">
and create_date = #{date}
</if>
<if test="recordTypes != null">
and record_type in
<foreach collection="recordTypes" index="index" item="item" open="(" separator="," close=")">
......@@ -163,6 +173,9 @@
<if test="queryName != null">
and from_name like concat("%",#{queryName},"%")
</if>
<if test="typeName != null">
and type_name = #{typeName}
</if>
ORDER BY
create_time DESC
</select>
......@@ -207,4 +220,55 @@
</select>
<select id="getAppletRecordCatalogue" parameterType="map" resultType="com.pcloud.book.applet.dto.AppletRecordDTO">
SELECT
record_type recordType,
type_code typeCode,
type_name typeName
FROM
applet_record_day_serve
WHERE
wechat_user_id = #{wechatUserId}
AND
create_date &gt; DATE_SUB(curdate(),INTERVAL 30 day)
AND
create_date = #{date}
AND
CASE
WHEN record_type in (1,5,6) THEN
type_name IS NOT NULL
ELSE
type_name IS NULL
END
GROUP BY
record_type,
type_name
</select>
<update id="batchUpdate" parameterType="list">
update
applet_record_day_serve
<trim prefix="set" suffixOverrides=",">
<trim prefix="type_code =case" suffix="end,">
<foreach collection="list" item="item">
<if test="item.typeCode!=null">
when id=#{item.id} then #{item.typeCode}
</if>
</foreach>
</trim>
<trim prefix="type_name =case" suffix="end,">
<foreach collection="list" item="item">
<if test="item.typeName!=null">
when id=#{item.id} then #{item.typeName}
</if>
</foreach>
</trim>
</trim>
<where>
<foreach collection="list" separator="or" item="item">
id = #{item.id}
</foreach>
</where>
</update>
</mapper>
\ No newline at end of file
......@@ -17,10 +17,12 @@
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="create_date" property="createDate" jdbcType="DATE"/>
<result column="is_delete" property="isDelete" jdbcType="INTEGER"/>
<result column="type_code" property="typeCode" jdbcType="VARCHAR"/>
<result column="type_name" property="typeName" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
id, wechat_user_id, record_type, rights_setting_id, book_id, channel_id, adviser_id, from_id, from_name, link_url, account_setting_id, create_time, create_date, is_delete
id, wechat_user_id, record_type, rights_setting_id, book_id, channel_id, adviser_id, from_id, from_name, link_url, account_setting_id, create_time, create_date, is_delete, type_code, type_name
</sql>
<select id="getById" resultMap="BaseResultMap">
......@@ -49,7 +51,9 @@
link_url,
account_setting_id,
create_time,
create_date
create_date,
type_code,
type_name
) VALUES (
#{wechatUserId, jdbcType=BIGINT},
#{recordType, jdbcType=INTEGER},
......@@ -62,7 +66,9 @@
#{linkUrl, jdbcType=VARCHAR},
#{accountSettingId, jdbcType=BIGINT},
now(),
CURRENT_DATE()
CURRENT_DATE(),
#{typeCode},
#{typeName}
)
</insert>
......@@ -116,7 +122,9 @@
link_url = #{linkUrl},
account_setting_id = #{accountSettingId},
create_time = now(),
create_date = CURRENT_DATE()
create_date = CURRENT_DATE(),
type_code = #{typeCode},
type_name = #{typeName}
</set>
WHERE id = #{id}
</update>
......@@ -151,8 +159,9 @@
`applet_record_serve`
WHERE
is_delete = 0
and
wechat_user_id = #{wechatUserId}
<if test="wechatUserId != null">
and wechat_user_id = #{wechatUserId}
</if>
<if test="recordTypes != null">
and record_type in
<foreach collection="recordTypes" index="index" item="item" open="(" separator="," close=")">
......@@ -164,6 +173,9 @@
<if test="queryName != null">
and from_name like concat("%",#{queryName},"%")
</if>
<if test="typeName != null">
and type_name = #{typeName}
</if>
ORDER BY
create_time DESC
</select>
......@@ -207,4 +219,52 @@
</foreach>
</select>
<select id="getAppletRecordCatalogue" parameterType="map" resultType="com.pcloud.book.applet.dto.AppletRecordDTO">
SELECT
record_type recordType,
type_code typeCode,
type_name typeName
FROM
applet_record_serve
WHERE
wechat_user_id = #{wechatUserId}
and
CASE
WHEN record_type in (1,5,6) THEN
type_name IS NOT NULL
ELSE
type_name IS NULL
END
AND
create_date &gt; DATE_SUB(curdate(),INTERVAL 30 day)
GROUP BY
record_type,
type_name
</select>
<update id="batchUpdate" parameterType="list">
update
applet_record_serve
<trim prefix="set" suffixOverrides=",">
<trim prefix="type_code =case" suffix="end,">
<foreach collection="list" item="item">
<if test="item.typeCode!=null">
when id=#{item.id} then #{item.typeCode}
</if>
</foreach>
</trim>
<trim prefix="type_name =case" suffix="end,">
<foreach collection="list" item="item">
<if test="item.typeName!=null">
when id=#{item.id} then #{item.typeName}
</if>
</foreach>
</trim>
</trim>
<where>
<foreach collection="list" separator="or" item="item">
id = #{item.id}
</foreach>
</where>
</update>
</mapper>
\ No newline at end of file
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