Commit 8bede34c by 裴大威

Merge branch 'feat-1002469' into 'master'

定制服务

See merge request rays/pcloud-book!504
parents 811f5fb4 194336de
...@@ -193,6 +193,12 @@ ...@@ -193,6 +193,12 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.pcloud.facade</groupId>
<artifactId>pcloud-facade-feedback</artifactId>
<version>${pcloud-facade.version}</version>
</dependency>
<dependency>
<groupId>fakepath</groupId> <groupId>fakepath</groupId>
<artifactId>jbarcode</artifactId> <artifactId>jbarcode</artifactId>
<version>0.2.8</version> <version>0.2.8</version>
......
package com.pcloud.book.consumer.feedback;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.ResponseHandleUtil;
import com.pcloud.contentcenter.resource.dto.ResourceDTO;
import com.pcloud.contentcenter.resource.service.ResourceService;
import com.pcloud.feedback.paper.dto.PaperDto;
import com.pcloud.feedback.paper.service.PaperService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Repository("feedbackConsr")
public class FeedbackConsr {
/**
* logger
*/
private static final Logger LOGGER = LoggerFactory.getLogger(FeedbackConsr.class);
@Autowired
private PaperService paperService;
/**
* 获取反馈问卷信息
*/
public Map<Long, PaperDto> getPaperListByIds(List<Long> paperIds) throws BizException {
LOGGER.info("获取反馈问卷信息[paperService.getPaperListByIds],参数列表[paperIds]:" + paperIds);
Map<Long, PaperDto> paperDtoMap = new HashMap<>();
if (ListUtils.isEmpty(paperIds)) {
return paperDtoMap;
}
try {
paperDtoMap = ResponseHandleUtil.parseMapResponse(paperService.getPaperListByIds(paperIds), Long.class, PaperDto.class);
} catch (BizException e) {
LOGGER.warn("获取反馈问卷信息[paperService.getPaperListByIds]:" + e.getMessage(), e);
throw new BizException(e.getCode(), e.getMessage());
} catch (Exception e) {
LOGGER.error("获取反馈问卷信息[paperService.getPaperListByIds]:" + e.getMessage(), e);
throw new BookBizException(BookBizException.INVOKE_CONTENT_ERROR, "获取反馈问卷信息失败~!");
}
return paperDtoMap;
}
/**
* 根据状态获取问卷ID
*/
public List<Long> getPaperIdsByState(Integer state) throws BizException {
LOGGER.info("根据状态获取问卷ID[paperService.getPaperIdsByState],参数列表[state]:" + state);
List<Long> paperIds = new ArrayList<>();
if (state == null) {
return paperIds;
}
try {
paperIds = ResponseHandleUtil.parseListResponse(paperService.getPaperIdsByState(state), Long.class);
} catch (BizException e) {
LOGGER.warn("根据状态获取问卷ID[paperService.getPaperIdsByState]:" + e.getMessage(), e);
throw new BizException(e.getCode(), e.getMessage());
} catch (Exception e) {
LOGGER.error("根据状态获取问卷ID[paperService.getPaperIdsByState]:" + e.getMessage(), e);
throw new BookBizException(BookBizException.INVOKE_CONTENT_ERROR, "根据状态获取问卷ID失败~!");
}
return paperIds;
}
}
package com.pcloud.book.consumer.shareimage;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.utils.ResponseHandleUtil;
import com.pcloud.facade.shareimage.dto.HtmlDto;
import com.pcloud.facade.shareimage.facade.Html2PdfService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
@Repository("shareImageConsr")
public class ShareImageConsr {
private static final Logger LOGGER = LoggerFactory.getLogger(ShareImageConsr.class);
@Autowired
private Html2PdfService html2PdfService;
/**
* html转pdf
* @param htmlDto
*/
@ParamLog(value = "html转pdf", isBefore = false)
public String htmlToPdf(HtmlDto htmlDto) {
String pdfUrl = "";
try {
pdfUrl = ResponseHandleUtil.parseResponse(html2PdfService.htmlToPdf(htmlDto), String.class);
} catch (Exception e) {
LOGGER.error("html2PdfService.htmlToPdf" + e.getMessage(), e);
}
return pdfUrl;
}
}
package com.pcloud.book.custom.biz;
import com.pcloud.book.custom.entity.CustomPlan;
import com.pcloud.book.custom.vo.CustomPlanModuleVO;
import com.pcloud.book.custom.vo.CustomPlanPaperVO;
import com.pcloud.book.custom.vo.EditCustomPlanModuleVO;
import com.pcloud.common.page.PageBeanNew;
import java.util.List;
import java.util.Map;
public interface CustomPlanBiz {
Integer createCustomPlan(CustomPlan customPlan);
void copyCustomPlan(Integer planId);
void updateCustomPlan(CustomPlan customPlan);
CustomPlan getCustomPlanById(Integer planId);
void deleteCustomPlanById(Integer planId);
PageBeanNew<CustomPlan> listCustomPlanByPage(Integer currentPage, Integer numPerPage, String content, Integer useState);
void editCustomPlanModule(EditCustomPlanModuleVO editCustomPlanModuleVO);
List<CustomPlanModuleVO> getCustomPlanModule(Integer planId);
PageBeanNew<CustomPlanPaperVO> listPlanPaperByPage(Integer currentPage, Integer numPerPage, Integer paperState, String content);
Map<String, Object> getShortLinkUrl(Long appId, Long productId, String linkUrl);
}
package com.pcloud.book.custom.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.util.Date;
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CustomPlan {
private Integer id;
private String planNumber;
private String planName;
private String createUserName;
private String description;
private Integer openFeedback;
private Integer paperId;
private String paperTitle;
private String paperDesc;
private Integer useState;
private String pdfUrl;
private String h5Url;
private String previewQrcodeUrl;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
}
\ No newline at end of file
package com.pcloud.book.custom.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.util.Date;
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CustomPlanModule {
private Integer id;
private Integer planId;
private Integer parentId;
private Integer moduleType;
private String picUrl;
private String typeName;
private String title;
private String content;
private Integer skillId;
private String skillCover;
private Long appId;
private String agentName;
private Long productId;
private String merchantName;
private String productUniqueNumber;
private String linkUrl;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
}
\ No newline at end of file
package com.pcloud.book.custom.enums;
public enum PlanModuleTypeEnum {
/**
* 图片模块
*/
PIC(1),
/**
* 文本模块
*/
TEXT(2),
/**
* 分组模块
*/
GROUP(3),
/**
* 技能方案模块
*/
SKILL(4),
/**
* 应用作品模块
*/
APP(5);
public final Integer value;
PlanModuleTypeEnum(Integer value) {
this.value = value;
}
}
package com.pcloud.book.custom.enums;
public enum PlanUseStateEnum {
/**
* 未使用
*/
NO(0),
/**
* 已使用
*/
YES(1);
public final Integer value;
PlanUseStateEnum(Integer value) {
this.value = value;
}
}
package com.pcloud.book.custom.facade;
import com.pcloud.book.custom.biz.CustomPlanBiz;
import com.pcloud.book.custom.entity.CustomPlan;
import com.pcloud.book.custom.vo.CustomPlanModuleVO;
import com.pcloud.book.custom.vo.EditCustomPlanModuleVO;
import com.pcloud.book.timecontrol.vo.CreateSelfPlanVO;
import com.pcloud.common.dto.ResponseDto;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RequestMapping("customPlan")
@RestController("customPlanFacade")
public class CustomPlanFacade {
@Autowired
private CustomPlanBiz customPlanBiz;
@ApiOperation("创建定制方案")
@PostMapping("createCustomPlan")
ResponseDto<?> createCustomPlan(@RequestHeader String token, @RequestBody CustomPlan customPlan) {
return new ResponseDto<>(customPlanBiz.createCustomPlan(customPlan));
}
@ApiOperation("复制定制方案")
@GetMapping("copyCustomPlan")
ResponseDto<?> copyCustomPlan(@RequestHeader String token, @RequestParam Integer planId) {
customPlanBiz.copyCustomPlan(planId);
return new ResponseDto<>();
}
@ApiOperation("修改定制方案")
@PostMapping("updateCustomPlan")
ResponseDto<?> updateCustomPlan(@RequestHeader String token, @RequestBody CustomPlan customPlan) {
customPlanBiz.updateCustomPlan(customPlan);
return new ResponseDto<>();
}
@ApiOperation("根据ID获取定制方案(平台端)")
@GetMapping("getCustomPlanById")
ResponseDto<?> getCustomPlanById(@RequestHeader String token, @RequestParam Integer planId) {
return new ResponseDto<>(customPlanBiz.getCustomPlanById(planId));
}
@ApiOperation("根据ID获取定制方案(微信端)")
@GetMapping("getCustomPlanById4Wechat")
ResponseDto<?> getCustomPlanById4Wechat(@RequestParam Integer planId) {
return new ResponseDto<>(customPlanBiz.getCustomPlanById(planId));
}
@ApiOperation("根据ID删除定制方案")
@GetMapping("deleteCustomPlanById")
ResponseDto<?> deleteCustomPlanById(@RequestHeader String token, @RequestParam Integer planId) {
customPlanBiz.deleteCustomPlanById(planId);
return new ResponseDto<>();
}
@ApiOperation("分页获取定制方案")
@GetMapping("listCustomPlanByPage")
ResponseDto<?> listCustomPlanByPage(@RequestHeader String token, @RequestParam Integer currentPage, @RequestParam Integer numPerPage,
@RequestParam(value = "content", required = false) String content, @RequestParam(value = "useState", required = false) Integer useState) {
return new ResponseDto<>(customPlanBiz.listCustomPlanByPage(currentPage, numPerPage, content, useState));
}
@ApiOperation("编辑方案模块")
@PostMapping("editCustomPlanModule")
ResponseDto<?> editCustomPlanModule(@RequestHeader String token, @RequestBody EditCustomPlanModuleVO editCustomPlanModuleVO) {
customPlanBiz.editCustomPlanModule(editCustomPlanModuleVO);
return new ResponseDto<>();
}
@ApiOperation("获取方案模块")
@GetMapping("getCustomPlanModule")
ResponseDto<?> getCustomPlanModule(@RequestHeader String token, @RequestParam Integer planId) {
return new ResponseDto<>(customPlanBiz.getCustomPlanModule(planId));
}
@ApiOperation("获取方案模块(客户端)")
@GetMapping("getCustomPlanModule4Wechat")
ResponseDto<?> getCustomPlanModule4Wechat(@RequestParam Integer planId) {
return new ResponseDto<>(customPlanBiz.getCustomPlanModule(planId));
}
@ApiOperation("分页获取定制方案问卷")
@GetMapping("listPlanPaperByPage")
ResponseDto<?> listPlanPaperByPage(@RequestHeader String token, @RequestParam Integer currentPage, @RequestParam Integer numPerPage,
@RequestParam(value = "paperState", required = false) Integer paperState,
@RequestParam(value = "content", required = false) String content) {
return new ResponseDto<>(customPlanBiz.listPlanPaperByPage(currentPage, numPerPage, paperState, content));
}
@ApiOperation("作品或应用链接转短链")
@GetMapping("getShortLinkUrl")
ResponseDto<?> getShortLinkUrl(@RequestHeader String token, @RequestParam(value = "appId", required = false) Long appId,
@RequestParam(value = "productId", required = false) Long productId,
@RequestParam(value = "linkUrl") String linkUrl) {
return new ResponseDto<>(customPlanBiz.getShortLinkUrl(appId, productId, linkUrl));
}
}
package com.pcloud.book.custom.mapper;
import com.pcloud.book.custom.entity.CustomPlan;
import com.pcloud.book.custom.vo.CustomPlanPaperVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
@Component("customPlanMapper")
public interface CustomPlanMapper {
void insert(CustomPlan customPlan);
void update(CustomPlan customPlan);
CustomPlan getById(@Param("id") Integer id);
void deleteById(@Param("id") Integer id);
int getCustomPlanCount(@Param("content") String content, @Param("useState") Integer useState);
List<CustomPlan> listCustomPlanByPage(@Param("pageNum") Integer pageNum, @Param("numPerPage") Integer numPerPage, @Param("content") String content, @Param("useState") Integer useState);
int getPlanPaperCount(Map<String, Object> paramMap);
List<CustomPlanPaperVO> listPlanPaperByPage(Map<String, Object> paramMap);
}
\ No newline at end of file
package com.pcloud.book.custom.mapper;
import com.pcloud.book.custom.entity.CustomPlanModule;
import com.pcloud.book.custom.vo.CustomPlanModuleVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
@Component("customPlanModuleMapper")
public interface CustomPlanModuleMapper {
void deleteByPlanId(@Param("planId") Integer planId);
void insert(CustomPlanModule planModule);
List<CustomPlanModuleVO> getCustomPlanModuleByPlanId(@Param("planId") Integer planId, @Param("parentId") Integer parentId);
}
\ No newline at end of file
package com.pcloud.book.custom.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.util.List;
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CustomPlanModuleVO {
private Integer id;
private Integer planId;
private Integer parentId;
private Integer moduleType;
private String picUrl;
private String typeName;
private String title;
private String content;
private Integer skillId;
private String skillCover;
private Long appId;
private String agentName;
private Long productId;
private String merchantName;
private String productUniqueNumber;
private String linkUrl;
private List<CustomPlanModuleVO> customPlanModuleVOList;
}
\ No newline at end of file
package com.pcloud.book.custom.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.util.Date;
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CustomPlanPaperVO {
private Integer id;
private String planNumber;
private String planName;
private Integer paperId;
private String paperTitle;
private Integer paperState;
private Integer paperUserCount;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
}
\ No newline at end of file
package com.pcloud.book.custom.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.util.Date;
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CustomPlanVO {
private Integer id;
private String planNumber;
private String planName;
private String createUserName;
private String description;
private Integer openFeedback;
private Integer paperId;
private String paperTitle;
private String paperDesc;
private Integer useState;
private String pdfUrl;
private String h5Url;
private String previewQrcodeUrl;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
}
\ No newline at end of file
package com.pcloud.book.custom.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.util.List;
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class EditCustomPlanModuleVO {
private Integer planId;
private String html;
private List<CustomPlanModuleVO> planModuleVOS;
}
\ No newline at end of file
package com.pcloud.book.custom.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.pcloud.common.vo.BaseVO;
import lombok.Data;
import java.util.Date;
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ToPdfVO extends BaseVO {
private String url;
private String name;
private String fileName;
private String container;
}
\ 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.pcloud.book.custom.mapper.CustomPlanMapper" >
<resultMap id="BaseResultMap" type="CustomPlan" >
<id column="id" jdbcType="INTEGER" property="id" />
<result column="plan_number" jdbcType="VARCHAR" property="planNumber" />
<result column="plan_name" jdbcType="VARCHAR" property="planName" />
<result column="create_user_name" jdbcType="VARCHAR" property="createUserName" />
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="open_feedback" jdbcType="INTEGER" property="openFeedback" />
<result column="paper_id" jdbcType="INTEGER" property="paperId" />
<result column="paper_title" jdbcType="VARCHAR" property="paperTitle" />
<result column="paper_desc" jdbcType="VARCHAR" property="paperDesc" />
<result column="use_state" jdbcType="INTEGER" property="useState" />
<result column="pdf_url" jdbcType="VARCHAR" property="pdfUrl" />
<result column="h5_url" jdbcType="VARCHAR" property="h5Url" />
<result column="preview_qrcode_url" jdbcType="VARCHAR" property="previewQrcodeUrl" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
id, plan_number, plan_name, create_user_name, description, open_feedback, paper_id,
paper_title, paper_desc, use_state, pdf_url, h5_url, preview_qrcode_url, create_time,
update_time
</sql>
<insert id="insert" parameterType="CustomPlan" useGeneratedKeys="true" keyProperty="id">
insert into custom_plan (plan_number, plan_name, create_user_name,
description, open_feedback, paper_id,
paper_title, paper_desc, use_state,
pdf_url, h5_url, preview_qrcode_url,
create_time, update_time)
values (#{planNumber,jdbcType=VARCHAR}, #{planName,jdbcType=VARCHAR}, #{createUserName,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR}, #{openFeedback,jdbcType=INTEGER}, #{paperId,jdbcType=INTEGER},
#{paperTitle,jdbcType=VARCHAR}, #{paperDesc,jdbcType=VARCHAR}, #{useState,jdbcType=INTEGER},
#{pdfUrl,jdbcType=VARCHAR}, #{h5Url,jdbcType=VARCHAR}, #{previewQrcodeUrl,jdbcType=VARCHAR},
NOW(), NOW())
</insert>
<update id="update" parameterType="CustomPlan">
update custom_plan
<set>
<if test="planNumber != null">
plan_number = #{planNumber,jdbcType=VARCHAR},
</if>
<if test="planName != null">
plan_name = #{planName,jdbcType=VARCHAR},
</if>
<if test="createUserName != null">
create_user_name = #{createUserName,jdbcType=VARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=VARCHAR},
</if>
<if test="openFeedback != null">
open_feedback = #{openFeedback,jdbcType=INTEGER},
</if>
<if test="paperId != null">
paper_id = #{paperId,jdbcType=INTEGER},
</if>
<if test="paperTitle != null">
paper_title = #{paperTitle,jdbcType=VARCHAR},
</if>
<if test="paperDesc != null">
paper_desc = #{paperDesc,jdbcType=VARCHAR},
</if>
<if test="useState != null">
use_state = #{useState,jdbcType=INTEGER},
</if>
<if test="pdfUrl != null">
pdf_url = #{pdfUrl,jdbcType=VARCHAR},
</if>
<if test="h5Url != null">
h5_url = #{h5Url,jdbcType=VARCHAR},
</if>
<if test="previewQrcodeUrl != null">
preview_qrcode_url = #{previewQrcodeUrl,jdbcType=VARCHAR},
</if>
update_time = NOW(),
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<delete id="deleteById">
delete from custom_plan
where id = #{id,jdbcType=INTEGER}
</delete>
<select id="getById" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from custom_plan
where id = #{id,jdbcType=INTEGER}
</select>
<select id="getCustomPlanCount" resultType="int">
select
count(1)
from custom_plan
where 1= 1
<if test="content != null">
and (plan_number like concat('%', #{content}, '%')
or plan_name like concat('%', #{content}, '%')
or create_user_name like concat('%', #{content}, '%'))
</if>
<if test="useState != null">
and use_state = #{useState}
</if>
</select>
<select id="listCustomPlanByPage" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from custom_plan
where 1= 1
<if test="content != null">
and (plan_number like concat('%', #{content}, '%')
or plan_name like concat('%', #{content}, '%')
or create_user_name like concat('%', #{content}, '%'))
</if>
<if test="useState != null">
and use_state = #{useState}
</if>
ORDER BY update_time DESC
LIMIT #{pageNum}, #{numPerPage}
</select>
<select id="getPlanPaperCount" parameterType="map" resultType="int">
select
count(1)
from custom_plan
where open_feedback = 1
and paper_id is not null
<if test="content != null">
and (plan_name like concat('%', #{content}, '%')
or paper_title like concat('%', #{content}, '%'))
</if>
<if test="paperIds != null and paperIds.size() > 0">
and paper_id in
<foreach collection="paperIds" item="item" open="(" separator="," close=")">
${item}
</foreach>
</if>
</select>
<select id="listPlanPaperByPage" parameterType="map" resultType="CustomPlanPaperVO">
select
id id,
plan_number planNumber,
plan_name planName,
paper_id paperId,
paper_title paperTitle,
create_time createTime
from custom_plan
where open_feedback = 1
and paper_id is not null
<if test="content != null">
and (plan_name like concat('%', #{content}, '%')
or paper_title like concat('%', #{content}, '%'))
</if>
<if test="paperIds != null and paperIds.size() > 0">
and paper_id in
<foreach collection="paperIds" item="item" open="(" separator="," close=")">
${item}
</foreach>
</if>
ORDER BY update_time DESC
LIMIT #{pageNum}, #{numPerPage}
</select>
</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.pcloud.book.custom.mapper.CustomPlanModuleMapper" >
<resultMap id="BaseResultMap" type="CustomPlanModuleVO" >
<id column="id" jdbcType="INTEGER" property="id" />
<result column="plan_id" jdbcType="INTEGER" property="planId" />
<result column="parent_id" jdbcType="INTEGER" property="parentId" />
<result column="module_type" jdbcType="INTEGER" property="moduleType" />
<result column="pic_url" jdbcType="VARCHAR" property="picUrl" />
<result column="type_name" jdbcType="VARCHAR" property="typeName" />
<result column="title" jdbcType="VARCHAR" property="title" />
<result column="content" jdbcType="VARCHAR" property="content" />
<result column="skill_id" jdbcType="INTEGER" property="skillId" />
<result column="skill_cover" jdbcType="VARCHAR" property="skillCover" />
<result column="app_id" jdbcType="BIGINT" property="appId" />
<result column="agent_name" jdbcType="VARCHAR" property="agentName" />
<result column="product_id" jdbcType="BIGINT" property="productId" />
<result column="merchant_name" jdbcType="VARCHAR" property="merchantName" />
<result column="product_unique_number" jdbcType="VARCHAR" property="productUniqueNumber" />
<result column="link_url" jdbcType="VARCHAR" property="linkUrl" />
</resultMap>
<sql id="Base_Column_List">
id, plan_id, parent_id, module_type, pic_url, type_name, title, content, skill_id, skill_cover,
app_id, agent_name, product_id, merchant_name, product_unique_number, link_url, create_time, update_time
</sql>
<insert id="insert" parameterType="CustomPlanModule" useGeneratedKeys="true" keyProperty="id">
insert into custom_plan_module (plan_id,parent_id, module_type, pic_url,
type_name, title, content,
skill_id, skill_cover, app_id, agent_name,
product_id, merchant_name, product_unique_number, link_url, create_time,
update_time)
values (#{planId,jdbcType=INTEGER}, #{parentId,jdbcType=INTEGER}, #{moduleType,jdbcType=INTEGER}, #{picUrl,jdbcType=VARCHAR},
#{typeName,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR},
#{skillId,jdbcType=INTEGER}, #{skillCover,jdbcType=VARCHAR}, #{appId,jdbcType=BIGINT}, #{agentName,jdbcType=VARCHAR},
#{productId,jdbcType=BIGINT}, #{merchantName,jdbcType=VARCHAR}, #{productUniqueNumber,jdbcType=VARCHAR}, #{linkUrl,jdbcType=VARCHAR},
NOW(), NOW())
</insert>
<update id="update" parameterType="CustomPlanModule">
update custom_plan_module
<set>
<if test="parentId != null">
parent_id = #{parentId,jdbcType=INTEGER},
</if>
<if test="moduleType != null">
module_type = #{moduleType,jdbcType=INTEGER},
</if>
<if test="picUrl != null">
pic_url = #{picUrl,jdbcType=VARCHAR},
</if>
<if test="typeName != null">
type_name = #{typeName,jdbcType=VARCHAR},
</if>
<if test="title != null">
title = #{title,jdbcType=VARCHAR},
</if>
<if test="content != null">
content = #{content,jdbcType=VARCHAR},
</if>
<if test="skillId != null">
skill_id = #{skillId,jdbcType=INTEGER},
</if>
<if test="skillCover != null">
skill_cover = #{skillCover,jdbcType=VARCHAR},
</if>
<if test="appId != null">
app_id = #{appId,jdbcType=BIGINT},
</if>
<if test="productId != null">
product_id = #{productId,jdbcType=BIGINT},
</if>
<if test="linkUrl != null">
link_url = #{linkUrl,jdbcType=VARCHAR},
</if>
update_time = NOW(),
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<delete id="deleteByPlanId" >
delete from custom_plan_module
where plan_id = #{planId,jdbcType=INTEGER}
</delete>
<select id="getCustomPlanModuleByPlanId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from custom_plan_module
where plan_id = #{planId,jdbcType=INTEGER}
and parent_id = #{parentId,jdbcType=INTEGER}
</select>
</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