| @@ -6,6 +6,7 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.WxOpinion; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.WxOpinionService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| @@ -14,10 +15,7 @@ import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.ModelAttribute; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @@ -48,4 +46,21 @@ public class WxOpinionController extends BaseController { | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| @SystemControllerLog(description = "问券调查--更新") | |||
| public ResultData update(@RequestBody WxOpinion record) { | |||
| logger.debug("[" + getIpAddr() + "] WxOpinionController::update"); | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| try { | |||
| wxOpinionService.saveOrUpdate(record); | |||
| } catch (MallinkException e) { | |||
| logger.error(e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| } | |||
| @@ -3,15 +3,15 @@ package com.iformall.controller.market; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.WxActivity; | |||
| import com.iformall.domain.po.WxQuestionOneself; | |||
| import com.iformall.domain.po.WxQuestionOneselfUser; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.enums.EnumQuestionOneselfStatus; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.WxQuestionOneselfService; | |||
| import com.iformall.service.WxQuestionOneselfUserService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| @@ -21,6 +21,9 @@ import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| @RestController | |||
| @RequestMapping("wxQuestionOneself") | |||
| @@ -32,6 +35,9 @@ public class WxQuestionOneselfController extends BaseController { | |||
| @Autowired | |||
| private WxQuestionOneselfService wxQuestionOneselfService; | |||
| @Autowired | |||
| private WxQuestionOneselfUserService wxQuestionOneselfUserService; | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @@ -59,9 +65,14 @@ public class WxQuestionOneselfController extends BaseController { | |||
| public ResultData add(@RequestBody WxQuestionOneself record) { | |||
| logger.debug("[" + getIpAddr() + "] WxQuestionOneselfController::add"); | |||
| record.setStatus(EnumQuestionOneselfStatus.STATUS_THROW_IN.getCode()); | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| wxQuestionOneselfService.saveOrUpdate(record); | |||
| try { | |||
| wxQuestionOneselfService.saveOrUpdate(record); | |||
| } catch (MallinkException e) { | |||
| logger.error(e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| @@ -71,9 +82,13 @@ public class WxQuestionOneselfController extends BaseController { | |||
| public ResultData update(@RequestBody WxQuestionOneself record) { | |||
| logger.debug("[" + getIpAddr() + "] WxQuestionOneselfController::update"); | |||
| record.setStatus(EnumQuestionOneselfStatus.STATUS_THROW_IN.getCode()); | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| wxQuestionOneselfService.saveOrUpdate(record); | |||
| try { | |||
| wxQuestionOneselfService.saveOrUpdate(record); | |||
| } catch (MallinkException e) { | |||
| logger.error(e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| @@ -93,12 +108,12 @@ public class WxQuestionOneselfController extends BaseController { | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @GetMapping("/detailsById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| @SystemControllerLog(description = "问券调查--查询") | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxQuestionOneselfController::findById"); | |||
| return new ResultData(wxQuestionOneselfService.getById(id)); | |||
| public ResultData detailsById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxQuestionOneselfController::detailsById"); | |||
| return new ResultData(wxQuestionOneselfService.detailsById(id)); | |||
| } | |||
| @ApiOperation("投放到宣传页") | |||
| @@ -111,11 +126,52 @@ public class WxQuestionOneselfController extends BaseController { | |||
| } | |||
| @ApiOperation("从宣传页下线") | |||
| @PostMapping("offLineCampaign") | |||
| @GetMapping("offLineCampaign") | |||
| @SystemControllerLog(description = "问券调查--从宣传页下线") | |||
| public ResultData offLineCampaign(@RequestBody WxQuestionOneself record) { | |||
| public ResultData offLineCampaign(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxQuestionOneselfController::offLineCampaign"); | |||
| return wxQuestionOneselfService.offLineCampaign(record); | |||
| return wxQuestionOneselfService.offLineCampaign(id); | |||
| } | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("userList") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true) | |||
| }) | |||
| @SystemControllerLog(description = "userList-列表") | |||
| public ResultData userList(@ModelAttribute WxQuestionOneselfUser record, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxQuestionOneselfController::userList"); | |||
| if (null == record) { | |||
| record = new WxQuestionOneselfUser(); | |||
| } | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| record.setSortColumns(BaseEntity.SortField.CreateDate_DESC); | |||
| final PageInfo<WxQuestionOneselfUser> page = wxQuestionOneselfUserService.listAsPage(record, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/userDetails") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| @SystemControllerLog(description = "问券调查--查询") | |||
| public ResultData userDetails(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxQuestionOneselfController::userDetails"); | |||
| return new ResultData(wxQuestionOneselfUserService.userDetailsById(id)); | |||
| } | |||
| @ApiOperation("导出") | |||
| @GetMapping("/exportData") | |||
| @SystemControllerLog(description = "导出") | |||
| public void exportData(@ModelAttribute WxQuestionOneselfUser record, HttpServletRequest request, HttpServletResponse response) { | |||
| logger.info("[" + getIpAddr() + "] WxQuestionOneselfController/exportData"); | |||
| logger.debug("[" + getIpAddr() + "] WxQuestionOneselfController::userList"); | |||
| if (null == record) { | |||
| record = new WxQuestionOneselfUser(); | |||
| } | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| record.setSortColumns(BaseEntity.SortField.CreateDate_DESC); | |||
| wxQuestionOneselfUserService.exportData(record, request, response); | |||
| } | |||
| } | |||
| @@ -152,3 +152,8 @@ CREATE TABLE `wx_opinion` ( | |||
| PRIMARY KEY (`id`) USING BTREE | |||
| ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic; | |||
| ALTER TABLE `wx_question_oneself_user` | |||
| MODIFY COLUMN `user_id` bigint(20) NOT NULL COMMENT '会员用户id' AFTER `parent_tenant_id`, | |||
| ADD UNIQUE INDEX `user_question_unique`(`user_id`, `question_id`); | |||
| @@ -154,7 +154,7 @@ public class BaseController { | |||
| cUserTokenService.updateTokenCache(token, cuser); | |||
| } | |||
| private WxCUserBasicInfo getCacheMember(Long memberId,String finalTenantId,String key,long seconds) throws Exception { | |||
| private WxCUserBasicInfo getCacheMember(Long memberId,String finalTenantId,String key,long seconds) throws MallinkException { | |||
| // 缓存 | |||
| WxCUserBasicInfo member = RedisCacheUtils.getCacheObject(objectCommonRedisTemplate, key, WxCUserBasicInfo.class); | |||
| if(null == member) { | |||
| @@ -169,7 +169,7 @@ public class BaseController { | |||
| return member; | |||
| } | |||
| public WxCUserBasicInfo getCacheMember() throws Exception { | |||
| public WxCUserBasicInfo getCacheMember() throws MallinkException { | |||
| Long memberId = getMemberId(); | |||
| String key = "webapp:member:"+memberId; | |||
| return getCacheMember(memberId,getFinalTenantId(), key, 3600*24*3); | |||
| @@ -1,21 +1,22 @@ | |||
| package com.iformall.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||
| import com.iformall.domain.po.WxOpinion; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.WxOpinionService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.ModelAttribute; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @@ -45,4 +46,32 @@ public class WxOpinionController extends BaseController { | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxOpinion record) { | |||
| logger.debug("[" + getIpAddr() + "] WxOpinionController::add"); | |||
| if(record == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| try { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| WxCUserBasicInfo cacheMember = getCacheMember(); | |||
| record.setUserId(cacheMember.getId()); | |||
| if(StringUtils.isBlank(record.getLiaisonPhone())){ | |||
| record.setLiaisonMan(cacheMember.getNickName()); | |||
| record.setLiaisonSex(cacheMember.getSex()); | |||
| record.setLiaisonPhone(cacheMember.getPhone()); | |||
| } | |||
| if(StringUtils.isBlank(record.getLiaisonPhone())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| wxOpinionService.saveOrUpdate(record); | |||
| } catch (MallinkException e) { | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| } | |||
| @@ -1,22 +1,29 @@ | |||
| package com.iformall.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||
| import com.iformall.domain.po.WxQuestionOneself; | |||
| import com.iformall.domain.po.WxQuestionOneselfUser; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.enums.EnumQuestionOneselfStatus; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.WxQuestionOneselfLogService; | |||
| import com.iformall.service.WxQuestionOneselfService; | |||
| import com.iformall.service.WxQuestionOneselfUserService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.ModelAttribute; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| @RestController | |||
| @@ -29,6 +36,12 @@ public class WxQuestionOneselfController extends BaseController { | |||
| @Autowired | |||
| private WxQuestionOneselfService wxQuestionOneselfService; | |||
| @Autowired | |||
| private WxQuestionOneselfUserService wxQuestionOneselfUserService; | |||
| @Autowired | |||
| private WxQuestionOneselfLogService wxQuestionOneselfLogService; | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @@ -46,7 +59,87 @@ public class WxQuestionOneselfController extends BaseController { | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| record.setSortColumns(BaseEntity.SortField.CreateDate_DESC,BaseEntity.SortField.Sort_DESC); | |||
| final PageInfo<WxQuestionOneself> page = wxQuestionOneselfService.listAsPage(record, pageNum, pageSize); | |||
| try { | |||
| WxQuestionOneselfUser userQ = new WxQuestionOneselfUser(); | |||
| userQ.updateTenantInfo(getTenantInfo()); | |||
| userQ.setUserId(getMemberId()); | |||
| for (WxQuestionOneself oneself:page.getList()) { | |||
| userQ.setQuestionId(oneself.getId()); | |||
| oneself.setUserStatus(wxQuestionOneselfUserService.countQuestion(userQ)); | |||
| } | |||
| } catch (MallinkException e) { | |||
| //return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/detailsById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData detailsById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxQuestionOneselfController::detailsById"); | |||
| Map<String,Object> map = new HashMap(); | |||
| WxQuestionOneself wxQuestionOneself = wxQuestionOneselfService.detailsById(id); | |||
| if(wxQuestionOneself != null){ | |||
| WxQuestionOneselfUser userQ = new WxQuestionOneselfUser(); | |||
| userQ.updateTenantInfo(getTenantInfo()); | |||
| userQ.setUserId(getMemberId()); | |||
| userQ.setQuestionId(wxQuestionOneself.getId()); | |||
| wxQuestionOneself.setUserStatus(wxQuestionOneselfUserService.countQuestion(userQ)); | |||
| if(wxQuestionOneself.getUserStatus().intValue() > 0){ | |||
| WxQuestionOneselfUser userDetails = wxQuestionOneselfUserService.userDetailsByUserQ(userQ); | |||
| map.put("userDetails",userDetails); | |||
| } | |||
| } | |||
| map.put("question",wxQuestionOneself); | |||
| return new ResultData(map); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("userAdd") | |||
| public ResultData userAdd(@RequestBody WxQuestionOneselfUser record) { | |||
| logger.debug("[" + getIpAddr() + "] WxQuestionOneselfController::userAdd"); | |||
| if(record == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| if(record.getQuestionId() == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| if(record.getLogList() == null || record.getLogList().size() == 0){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| try { | |||
| WxQuestionOneselfUser userQ = new WxQuestionOneselfUser(); | |||
| userQ.updateTenantInfo(getTenantInfo()); | |||
| userQ.setUserId(getMemberId()); | |||
| userQ.setQuestionId(record.getQuestionId()); | |||
| Integer countQuestion = wxQuestionOneselfUserService.countQuestion(userQ); | |||
| if(countQuestion.intValue() > 0){ | |||
| return new ResultData(ErrorCode.QUESTION_USER_LINE); | |||
| } | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| WxCUserBasicInfo cacheMember = getCacheMember(); | |||
| record.setUserId(cacheMember.getId()); | |||
| if(StringUtils.isBlank(record.getUserPhone())){ | |||
| record.setUserName(cacheMember.getNickName()); | |||
| record.setUserSex(cacheMember.getSex()); | |||
| record.setUserPhone(cacheMember.getPhone()); | |||
| } | |||
| wxQuestionOneselfUserService.saveOrUpdate(record); | |||
| } catch (MallinkException e) { | |||
| logger.error(e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } catch (Exception e1){ | |||
| logger.error(e1.getMessage()); | |||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| } | |||
| @@ -593,6 +593,10 @@ public enum ErrorCode{ | |||
| QUESTION_NOT_LINE(61002, "投放到宣传页失败,问卷未上线!"), | |||
| QUESTION_SENDUP_ERROR(61003, "投放到宣传页失败,宣传页显示已达七条上限!"), | |||
| QUESTION_NOT_INTO(61004, "取消投放失败,不是投放状态"), | |||
| QUESTION_UPUP_LINE(61005, "修改失败,问卷上过线!"), | |||
| QUESTION_USER_NOT(61006, "答题参数错误!"), | |||
| QUESTION_USER_LINE(61007, "已经参与!"), | |||
| ; | |||
| @@ -8,6 +8,7 @@ import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @TableName(value = "wx_question_oneself") | |||
| @Data | |||
| @@ -69,6 +70,13 @@ public class WxQuestionOneself extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="题目总分数",name="countUser") | |||
| private Integer countUser; | |||
| @TableField(exist = false) | |||
| private List<WxQuestionOneselfTopic> topicList; | |||
| @io.swagger.annotations.ApiModelProperty(value = "0:未完成,1:已完成", name = "userStatus") | |||
| @TableField(exist = false) | |||
| private Integer userStatus; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value = "小程序路径", name = "weappPath") | |||
| @@ -27,15 +27,24 @@ public class WxQuestionOneselfLog extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="问题Id",name="topicId") | |||
| private Long topicId; | |||
| @io.swagger.annotations.ApiModelProperty(value="答案",name="topicTitle") | |||
| @io.swagger.annotations.ApiModelProperty(value="问题标题",name="topicTitle") | |||
| private String topicTitle; | |||
| @io.swagger.annotations.ApiModelProperty(value="答案id(目前为答案对应的标签id)",name="answer") | |||
| @io.swagger.annotations.ApiModelProperty(value="答案id(目前为答案对应的标签id) 数组",name="answer") | |||
| private String answer; | |||
| @io.swagger.annotations.ApiModelProperty(value="答案",name="answerStr") | |||
| private String answerStr; | |||
| @TableField(exist = false) | |||
| private String answers; | |||
| @TableField(exist = false) | |||
| private String type; | |||
| @TableField(exist = false) | |||
| private Integer sort; | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| @@ -7,6 +7,7 @@ import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @TableName(value = "wx_question_oneself_user") | |||
| @Data | |||
| @@ -43,4 +44,8 @@ public class WxQuestionOneselfUser extends TenantEntity { | |||
| private Date updateDate; | |||
| @TableField(exist = false) | |||
| private List<WxQuestionOneselfLog> logList ; | |||
| } | |||
| @@ -25,7 +25,11 @@ public enum EnumScoreType { | |||
| SIGN_IN_DAY(17, "每日签到"), | |||
| SIGN_IN_SEVENDAY(18, "连续签到7天"), | |||
| SIGN_IN_FTDAY(19, "连续签到14天"), | |||
| SIGN_IN_TEDAY(20, "连续签到28天"),; | |||
| SIGN_IN_TEDAY(20, "连续签到28天"), | |||
| QUESTION_ADD_CREDIT(21, "游戏奖励积分"), | |||
| ; | |||
| public static EnumScoreType getEnum(Integer code) { | |||
| for (EnumScoreType value : values()) { | |||
| @@ -8,5 +8,8 @@ import java.util.List; | |||
| public interface WxQuestionOneselfLogMapper extends CommonMapper<WxQuestionOneselfLog, String> { | |||
| List<WxQuestionOneselfLog> findList(WxQuestionOneselfLog record); | |||
| List<WxQuestionOneselfLog> findDetailsList(WxQuestionOneselfLog record); | |||
| void insertList(List<WxQuestionOneselfLog> logList); | |||
| } | |||
| @@ -9,4 +9,5 @@ public interface WxQuestionOneselfMapper extends CommonMapper<WxQuestionOneself, | |||
| List<WxQuestionOneself> findList(WxQuestionOneself record); | |||
| void updateCountUser(Long id); | |||
| } | |||
| @@ -9,4 +9,7 @@ public interface WxQuestionOneselfTopicMapper extends CommonMapper<WxQuestionOne | |||
| List<WxQuestionOneselfTopic> findList(WxQuestionOneselfTopic record); | |||
| void deleteQuestionId(WxQuestionOneselfTopic record); | |||
| void insertList(List<WxQuestionOneselfTopic> topicList); | |||
| } | |||
| @@ -9,4 +9,5 @@ public interface WxQuestionOneselfUserMapper extends CommonMapper<WxQuestionOnes | |||
| List<WxQuestionOneselfUser> findList(WxQuestionOneselfUser record); | |||
| int countQuestion(WxQuestionOneselfUser record); | |||
| } | |||
| @@ -1,6 +1,7 @@ | |||
| package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxActivity; | |||
| import com.iformall.domain.po.WxQuestionOneself; | |||
| @@ -28,6 +29,8 @@ public interface WxQuestionOneselfService { | |||
| * @return | |||
| */ | |||
| WxQuestionOneself getById(Long id); | |||
| WxQuestionOneself detailsById(Long id); | |||
| /** | |||
| * 保存或更新实体 | |||
| @@ -48,5 +51,7 @@ public interface WxQuestionOneselfService { | |||
| ResultData sendToCampaign(Long id); | |||
| ResultData offLineCampaign(WxQuestionOneself record); | |||
| ResultData offLineCampaign(Long id); | |||
| } | |||
| @@ -1,8 +1,11 @@ | |||
| package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.domain.po.WxQuestionOneselfUser; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.List; | |||
| public interface WxQuestionOneselfUserService { | |||
| @@ -26,6 +29,8 @@ public interface WxQuestionOneselfUserService { | |||
| * @return | |||
| */ | |||
| WxQuestionOneselfUser getById(Long id); | |||
| WxQuestionOneselfUser userDetailsById(Long id); | |||
| /** | |||
| * 保存或更新实体 | |||
| @@ -42,4 +47,9 @@ public interface WxQuestionOneselfUserService { | |||
| void deleteById(Long id); | |||
| void exportData(WxQuestionOneselfUser record, HttpServletRequest request, HttpServletResponse response); | |||
| Integer countQuestion(WxQuestionOneselfUser record); | |||
| WxQuestionOneselfUser userDetailsByUserQ(WxQuestionOneselfUser record); | |||
| } | |||
| @@ -5,15 +5,15 @@ import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxActivity; | |||
| import com.iformall.domain.po.WxCampaign; | |||
| import com.iformall.domain.po.WxQuestionOneself; | |||
| import com.iformall.domain.po.WxQuestionOneselfTopic; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxCampaignMapper; | |||
| import com.iformall.mapper.WxQuestionOneselfMapper; | |||
| import com.iformall.mapper.WxQuestionOneselfTopicMapper; | |||
| import com.iformall.service.WxCampaignService; | |||
| import com.iformall.service.WxQuestionOneselfService; | |||
| import org.slf4j.Logger; | |||
| @@ -34,6 +34,9 @@ public class WxQuestionOneselfServiceImpl implements WxQuestionOneselfService { | |||
| @Autowired | |||
| WxQuestionOneselfMapper wxQuestionOneselfMapper; | |||
| @Autowired | |||
| WxQuestionOneselfTopicMapper wxQuestionOneselfTopicMapper; | |||
| @Autowired | |||
| WxCampaignMapper wxCampaignMapper; | |||
| @@ -55,19 +58,71 @@ public class WxQuestionOneselfServiceImpl implements WxQuestionOneselfService { | |||
| return wxQuestionOneselfMapper.selectById(id); | |||
| } | |||
| @Override | |||
| public WxQuestionOneself detailsById(Long id) { | |||
| WxQuestionOneself wxQuestionOneself = wxQuestionOneselfMapper.selectById(id); | |||
| if(wxQuestionOneself == null){ | |||
| return null; | |||
| } | |||
| WxQuestionOneselfTopic topicQuery = new WxQuestionOneselfTopic(); | |||
| topicQuery.updateTenantInfo(wxQuestionOneself); | |||
| topicQuery.setQuestionId(id); | |||
| List<WxQuestionOneselfTopic> topiclist = wxQuestionOneselfTopicMapper.findList(topicQuery); | |||
| wxQuestionOneself.setTopicList(topiclist); | |||
| return wxQuestionOneself; | |||
| } | |||
| @Transactional(propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | |||
| @Override | |||
| public void saveOrUpdate(WxQuestionOneself record) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| Date now = new Date(); | |||
| record.setStatus(EnumQuestionOneselfStatus.STATUS_THROW_IN.getCode()); | |||
| record.setUpdateDate(now); | |||
| if (record.getId() == null) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| record.setCreateDate(now); | |||
| record.setUpdateDate(now); | |||
| wxQuestionOneselfMapper.insert(record); | |||
| } else { | |||
| record.setUpdateDate(now); | |||
| WxQuestionOneself byId = this.getById(record.getId()); | |||
| if(!byId.getStatus().equals(EnumQuestionOneselfStatus.STATUS_THROW_IN.getCode())){ | |||
| throw new MallinkException(ErrorCode.QUESTION_UPUP_LINE); | |||
| } | |||
| WxQuestionOneselfTopic wxQuestionOneselfTopic = new WxQuestionOneselfTopic(); | |||
| wxQuestionOneselfTopic.updateTenantInfo(record); | |||
| wxQuestionOneselfTopic.setQuestionId(record.getId()); | |||
| wxQuestionOneselfTopicMapper.deleteQuestionId(wxQuestionOneselfTopic); | |||
| wxQuestionOneselfMapper.updateById(record); | |||
| } | |||
| int countTopic = 0; | |||
| List<WxQuestionOneselfTopic> topicList = record.getTopicList(); | |||
| if(topicList != null && topicList.size() > 0){ | |||
| countTopic = topicList.size(); | |||
| for(int i = 0;i < countTopic;i++){ | |||
| WxQuestionOneselfTopic topic = topicList.get(i); | |||
| if(topic.getId() == null){ | |||
| topic.setId(idWorker.nextId()); | |||
| topic.setCreateDate(now); | |||
| } | |||
| topic.setQuestionId(record.getId()); | |||
| topic.updateTenantInfo(record); | |||
| topic.setUpdateDate(now); | |||
| topic.setSort(i+1); | |||
| } | |||
| wxQuestionOneselfTopicMapper.insertList(topicList); | |||
| } | |||
| if(record.getCountTopic() == null || record.getCountTopic().intValue() != countTopic){ | |||
| record.setCountTopic(countTopic); | |||
| wxQuestionOneselfMapper.updateById(record); | |||
| } | |||
| } | |||
| @Override | |||
| @@ -82,7 +137,9 @@ public class WxQuestionOneselfServiceImpl implements WxQuestionOneselfService { | |||
| if (byId == null) { | |||
| return new ResultData(ErrorCode.QUESTION_NOT_FOUND); | |||
| } | |||
| this.saveOrUpdate(record); | |||
| record.setUpdateDate(new Date()); | |||
| wxQuestionOneselfMapper.updateById(record); | |||
| if(record.getStatus().equals(EnumQuestionOneselfStatus.STATUS_TAKE_OFFF.getCode())){ | |||
| WxCampaign campaign = new WxCampaign(); | |||
| campaign.updateTenantInfo(byId); | |||
| @@ -119,7 +176,8 @@ public class WxQuestionOneselfServiceImpl implements WxQuestionOneselfService { | |||
| WxQuestionOneself record = new WxQuestionOneself(); | |||
| record.setId(id); | |||
| record.setStatus(EnumQuestionOneselfStatus.INJECT_CAMPAIGN.getCode()); | |||
| this.saveOrUpdate(record); | |||
| record.setUpdateDate(new Date()); | |||
| wxQuestionOneselfMapper.updateById(record); | |||
| campaignQuery = new WxCampaign(); | |||
| campaignQuery.updateTenantInfo(byId); | |||
| @@ -143,18 +201,22 @@ public class WxQuestionOneselfServiceImpl implements WxQuestionOneselfService { | |||
| return wxCampaignService.addForPath(campaign); | |||
| } | |||
| @Transactional(propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | |||
| @Override | |||
| public ResultData offLineCampaign(WxQuestionOneself record) { | |||
| WxQuestionOneself byId = this.getById(record.getId()); | |||
| public ResultData offLineCampaign(Long id) { | |||
| WxQuestionOneself byId = this.getById(id); | |||
| if (byId == null) { | |||
| return new ResultData(ErrorCode.QUESTION_NOT_FOUND); | |||
| } | |||
| if(!record.getStatus().equals(EnumQuestionOneselfStatus.INJECT_CAMPAIGN.getCode())) { | |||
| if(!byId.getStatus().equals(EnumQuestionOneselfStatus.INJECT_CAMPAIGN.getCode())) { | |||
| return new ResultData(ErrorCode.QUESTION_NOT_INTO); | |||
| } | |||
| WxQuestionOneself record = new WxQuestionOneself(); | |||
| record.setId(id); | |||
| record.setStatus(EnumQuestionOneselfStatus.INJECT_ONLINE.getCode()); | |||
| this.saveOrUpdate(record); | |||
| record.setUpdateDate(new Date()); | |||
| wxQuestionOneselfMapper.updateById(record); | |||
| WxCampaign campaign = new WxCampaign(); | |||
| campaign.updateTenantInfo(byId); | |||
| @@ -1,18 +1,33 @@ | |||
| package com.iformall.service.impl; | |||
| import com.alibaba.fastjson.JSONArray; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.po.WxQuestionOneselfUser; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.enums.EnumScoreType; | |||
| import com.iformall.enums.EnumUserType; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxQuestionOneselfLogMapper; | |||
| import com.iformall.mapper.WxQuestionOneselfMapper; | |||
| import com.iformall.mapper.WxQuestionOneselfTopicMapper; | |||
| import com.iformall.mapper.WxQuestionOneselfUserMapper; | |||
| import com.iformall.service.ExcelService; | |||
| import com.iformall.service.WxCreditHistoryService; | |||
| import com.iformall.service.WxQuestionOneselfUserService; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Propagation; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.*; | |||
| @Service | |||
| public class WxQuestionOneselfUserServiceImpl implements WxQuestionOneselfUserService { | |||
| @@ -22,6 +37,21 @@ public class WxQuestionOneselfUserServiceImpl implements WxQuestionOneselfUserSe | |||
| @Autowired | |||
| WxQuestionOneselfUserMapper wxQuestionOneselfUserMapper; | |||
| @Autowired | |||
| WxQuestionOneselfLogMapper wxQuestionOneselfLogMapper; | |||
| @Autowired | |||
| WxQuestionOneselfMapper wxQuestionOneselfMapper; | |||
| @Autowired | |||
| WxQuestionOneselfTopicMapper wxQuestionOneselfTopicMapper; | |||
| @Autowired | |||
| WxCreditHistoryService wxCreditHistoryService; | |||
| @Autowired | |||
| ExcelService excelService; | |||
| @Override | |||
| public List<WxQuestionOneselfUser> findList(WxQuestionOneselfUser record) { | |||
| return wxQuestionOneselfUserMapper.findList(record); | |||
| @@ -37,19 +67,94 @@ public class WxQuestionOneselfUserServiceImpl implements WxQuestionOneselfUserSe | |||
| return wxQuestionOneselfUserMapper.selectById(id); | |||
| } | |||
| @Override | |||
| public WxQuestionOneselfUser userDetailsById(Long id) { | |||
| WxQuestionOneselfUser wxQuestionOneselfUser = wxQuestionOneselfUserMapper.selectById(id); | |||
| if(wxQuestionOneselfUser == null){ | |||
| return null; | |||
| } | |||
| WxQuestionOneselfLog logQuery = new WxQuestionOneselfLog(); | |||
| logQuery.updateTenantInfo(wxQuestionOneselfUser); | |||
| logQuery.setWqouId(id); | |||
| List<WxQuestionOneselfLog> logList = wxQuestionOneselfLogMapper.findDetailsList(logQuery); | |||
| wxQuestionOneselfUser.setLogList(logList); | |||
| return wxQuestionOneselfUser; | |||
| } | |||
| @Transactional(propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | |||
| @Override | |||
| public void saveOrUpdate(WxQuestionOneselfUser record) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| Date now = new Date(); | |||
| record.setUpdateDate(now); | |||
| if (record.getId() == null) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| record.setCreateDate(now); | |||
| record.setUpdateDate(now); | |||
| wxQuestionOneselfUserMapper.insert(record); | |||
| } else { | |||
| record.setUpdateDate(now); | |||
| wxQuestionOneselfUserMapper.updateById(record); | |||
| } | |||
| WxQuestionOneselfTopic topicQuery = new WxQuestionOneselfTopic(); | |||
| topicQuery.updateTenantInfo(record); | |||
| topicQuery.setQuestionId(record.getQuestionId()); | |||
| List<WxQuestionOneselfTopic> topiclist = wxQuestionOneselfTopicMapper.findList(topicQuery); | |||
| Map<Long,WxQuestionOneselfTopic> topicMap = new HashMap<>(); | |||
| for (WxQuestionOneselfTopic topic:topiclist) { | |||
| topicMap.put(topic.getId(),topic); | |||
| } | |||
| List<WxQuestionOneselfLog> logList = record.getLogList(); | |||
| if(logList != null && logList.size() > 0){ | |||
| for (WxQuestionOneselfLog log:logList) { | |||
| log.setId(idWorker.nextId()); | |||
| log.updateTenantInfo(record); | |||
| log.setWqouId(record.getId()); | |||
| log.setTopicTitle(topicMap.get(log.getTopicId()).getTitle()); | |||
| JSONArray topTicAnswer = JSONArray.parseArray(topicMap.get(log.getTopicId()).getAnswer()); | |||
| JSONArray userAnswer = JSONArray.parseArray(log.getAnswer()); | |||
| String answerStr = ""; | |||
| for(int i = 0;i < topTicAnswer.size();i++){ | |||
| JSONObject jsonObject = topTicAnswer.getJSONObject(i); | |||
| String id = jsonObject.getString("id"); | |||
| String name = jsonObject.getString("name"); | |||
| for(int j = 0;j < userAnswer.size();j++){ | |||
| String string = userAnswer.getString(j); | |||
| if(id.equals(string)){ | |||
| answerStr += name + ","; | |||
| } | |||
| } | |||
| } | |||
| if(StringUtils.isNotBlank(answerStr)){ | |||
| answerStr = answerStr.substring(0,answerStr.length()-1); | |||
| } | |||
| log.setAnswerStr(answerStr); | |||
| log.setCreateDate(now); | |||
| log.setUpdateDate(now); | |||
| } | |||
| wxQuestionOneselfLogMapper.insertList(logList); | |||
| }else{ | |||
| throw new MallinkException(ErrorCode.QUESTION_UPUP_LINE); | |||
| } | |||
| wxQuestionOneselfMapper.updateCountUser(record.getQuestionId()); | |||
| WxQuestionOneself wxQuestionOneself = wxQuestionOneselfMapper.selectById(record.getQuestionId()); | |||
| if(wxQuestionOneself.getRewardCredit() != null && wxQuestionOneself.getRewardCredit() >= 0){ | |||
| WxCreditHistory wxCreditHistory = new WxCreditHistory(); | |||
| wxCreditHistory.setTenantId(record.getFinalTenantId()); | |||
| wxCreditHistory.setCUserId(record.getUserId()); | |||
| wxCreditHistory.setOperatorId(record.getUserId()); | |||
| wxCreditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode()); | |||
| wxCreditHistory.setCreditNum(wxQuestionOneself.getRewardCredit()); | |||
| wxCreditHistory.setCreditType(EnumScoreType.QUESTION_ADD_CREDIT.getCode()); | |||
| wxCreditHistory.setChangePurpose(EnumScoreType.QUESTION_ADD_CREDIT.getMessage()); | |||
| wxCreditHistoryService.saveOrUpdate(wxCreditHistory,record.getTenantId()); | |||
| } | |||
| } | |||
| @Override | |||
| @@ -57,4 +162,33 @@ public class WxQuestionOneselfUserServiceImpl implements WxQuestionOneselfUserSe | |||
| // wxQuestionOneselfUserMapper.deleteById(id); | |||
| } | |||
| @Override | |||
| public void exportData(WxQuestionOneselfUser record, HttpServletRequest request, HttpServletResponse response) { | |||
| wxQuestionOneselfUserMapper.findList(record); | |||
| // excelService.exportExcel(); | |||
| } | |||
| @Override | |||
| public Integer countQuestion(WxQuestionOneselfUser record) { | |||
| return wxQuestionOneselfUserMapper.countQuestion(record); | |||
| } | |||
| @Override | |||
| public WxQuestionOneselfUser userDetailsByUserQ(WxQuestionOneselfUser record) { | |||
| List<WxQuestionOneselfUser> userlist = wxQuestionOneselfUserMapper.findList(record); | |||
| if(userlist != null && userlist.size() > 0){ | |||
| WxQuestionOneselfUser wxQuestionOneselfUser = userlist.get(0); | |||
| if(wxQuestionOneselfUser == null){ | |||
| return null; | |||
| } | |||
| WxQuestionOneselfLog logQuery = new WxQuestionOneselfLog(); | |||
| logQuery.updateTenantInfo(wxQuestionOneselfUser); | |||
| logQuery.setWqouId(wxQuestionOneselfUser.getId()); | |||
| List<WxQuestionOneselfLog> logList = wxQuestionOneselfLogMapper.findDetailsList(logQuery); | |||
| wxQuestionOneselfUser.setLogList(logList); | |||
| return wxQuestionOneselfUser; | |||
| } | |||
| return null; | |||
| } | |||
| } | |||
| @@ -55,6 +55,7 @@ | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| <if test=" null == sortColumns">order by </if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxQuestionOneselfLog" resultMap="BaseResultMap"> | |||
| @@ -64,4 +65,35 @@ | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="findDetailsList" parameterType="com.iformall.domain.po.WxQuestionOneselfLog" resultMap="com.iformall.domain.po.WxQuestionOneselfLog"> | |||
| select wqol.*,wqot.answer as answers,wqot.type,wqot.sort | |||
| from wx_question_oneself_log wqol | |||
| left join wx_question_oneself_topic wqot on wqot.id = wqol.topic_id | |||
| where wqol.wqou_id = #{wqouId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| order by wqot.sort | |||
| </select> | |||
| <insert id="insertList" parameterType="java.util.List"> | |||
| insert into wx_question_oneself_log | |||
| (`id`,`tenant_id`,`parent_tenant_id`, `wqou_id`, `topic_id`, `topic_title`, `answer`, `answer_str`,`create_date`,`update_date`) | |||
| values | |||
| <foreach collection="list" item="item" index="index" separator=","> | |||
| (#{item.id,jdbcType=BIGINT}, | |||
| #{item.tenantId,jdbcType=VARCHAR}, | |||
| #{item.parentTenantId,jdbcType=VARCHAR}, | |||
| #{item.wqouId,jdbcType=BIGINT}, | |||
| #{item.topicId,jdbcType=BIGINT}, | |||
| #{item.topicTitle,jdbcType=VARCHAR}, | |||
| #{item.answer,jdbcType=json}, | |||
| #{item.answerStr,jdbcType=VARCHAR}, | |||
| #{item.createDate,jdbcType=datetime}, | |||
| #{item.updateDate,jdbcType=datetime}) | |||
| </foreach> | |||
| </insert> | |||
| </mapper> | |||
| @@ -93,4 +93,10 @@ | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <update id="updateCountUser" parameterType="Long"> | |||
| update wx_question_oneself set count_user += count_user+1 | |||
| where id = #{id} | |||
| </update> | |||
| </mapper> | |||
| @@ -59,6 +59,8 @@ | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| <if test=" null == sortColumns">order by `sort`</if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxQuestionOneselfTopic" resultMap="BaseResultMap"> | |||
| @@ -68,4 +70,33 @@ | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <delete id="deleteQuestionId" parameterType="com.iformall.domain.po.WxQuestionOneselfTopic"> | |||
| delete from wx_question_oneself_topic | |||
| where question_id = #{questionId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </delete> | |||
| <insert id="insertList" parameterType="java.util.List"> | |||
| insert into wx_question_oneself_topic | |||
| (`id`,`tenant_id`,`parent_tenant_id`, `question_id`, `title`, `answer`, `type`, `create_date`,`update_date`,`sort`) | |||
| values | |||
| <foreach collection="list" item="item" index="index" separator=","> | |||
| (#{item.id,jdbcType=BIGINT}, | |||
| #{item.tenantId,jdbcType=VARCHAR}, | |||
| #{item.parentTenantId,jdbcType=VARCHAR}, | |||
| #{item.questionId,jdbcType=BIGINT}, | |||
| #{item.title,jdbcType=VARCHAR}, | |||
| #{item.answer,jdbcType=json}, | |||
| #{item.type,jdbcType=tinyint}, | |||
| #{item.createDate,jdbcType=datetime}, | |||
| #{item.updateDate,jdbcType=datetime}, | |||
| #{item.sort,jdbcType=INT}) | |||
| </foreach> | |||
| </insert> | |||
| </mapper> | |||
| @@ -49,6 +49,10 @@ | |||
| and `user_sex` = #{userSex} | |||
| </if> | |||
| <if test=" null != questionId "> | |||
| and `question_id` = #{questionId} | |||
| </if> | |||
| <if test=" null != startDate "> | |||
| and `create_date` >= #{startDate} | |||
| </if> | |||
| @@ -72,4 +76,19 @@ | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="countQuestion" parameterType="com.iformall.domain.po.WxQuestionOneselfUser" resultType="java.lang.Integer"> | |||
| select count(1) | |||
| from wx_question_oneself_user | |||
| where `user_id` = #{userId} | |||
| and `question_id` = #{questionId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </select> | |||
| </mapper> | |||