| @@ -0,0 +1,84 @@ | |||
| package com.iformall.controller; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONArray; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxQuestion; | |||
| import com.iformall.domain.po.WxQuestionConfig; | |||
| import com.iformall.enums.EnumQuestionConfigStatus; | |||
| import com.iformall.service.*; | |||
| import io.swagger.annotations.Api; | |||
| 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.RequestBody; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| @RestController | |||
| @RequestMapping("wxQuestion") | |||
| @Api(description="标签弹窗接口") | |||
| public class WxQuestionController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxQuestionService wxQuestionService; | |||
| @ApiOperation("查寻问券配置") | |||
| @GetMapping("getConfig") | |||
| public Result getQuestionConfig() { | |||
| WxQuestionConfig wxQuestionConfig = new WxQuestionConfig(); | |||
| WxQuestion wxQuestion = new WxQuestion(); | |||
| wxQuestionConfig.setTenantId(getTenantId()); | |||
| wxQuestion.setTenantId(getTenantId()); | |||
| List<WxQuestionConfig> list = wxQuestionService.findConfigList(wxQuestionConfig); | |||
| if (list.size() > 0) { | |||
| list.get(0).setQuestions(wxQuestionService.findList(wxQuestion)); | |||
| return new ResultData(list.get(0)); | |||
| } | |||
| wxQuestionConfig.setQuestions(wxQuestionService.findList(wxQuestion)); | |||
| wxQuestionConfig.setQuestionList(""); | |||
| wxQuestionConfig.setCouponTypeList(""); | |||
| wxQuestionConfig.setStatus(EnumQuestionConfigStatus.OFF.getCode()); | |||
| return new ResultData(wxQuestionConfig); | |||
| } | |||
| @ApiOperation("设置问券配置") | |||
| @GetMapping("setConfig") | |||
| public Result setQuestionConfig(@RequestBody WxQuestionConfig wxQuestionConfig) { | |||
| if (wxQuestionConfig == null) | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| if (wxQuestionConfig.getQuestionList() == null) | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| if (wxQuestionConfig.getCouponTypeList() == null) | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| String[] arys1 = wxQuestionConfig.getQuestionList().split(","); | |||
| List<Long> qs = new ArrayList<>(); | |||
| for (int i = 0; i < arys1.length; i++) { | |||
| qs.add(Long.parseLong(arys1[i])); | |||
| } | |||
| String[] arys2 = wxQuestionConfig.getCouponTypeList().split(","); | |||
| List<Long> ct = new ArrayList<>(); | |||
| for (int i = 0; i < arys2.length; i++) { | |||
| ct.add(Long.parseLong(arys2[i])); | |||
| } | |||
| wxQuestionConfig.setQuestionList(JSONObject.toJSONString(qs)); | |||
| wxQuestionConfig.setCouponTypeList(JSONObject.toJSONString(ct)); | |||
| wxQuestionConfig.setTenantId(getTenantId()); | |||
| wxQuestionService.saveOrUpdateConfig(wxQuestionConfig); | |||
| return new ResultData(); | |||
| } | |||
| } | |||
| @@ -0,0 +1,120 @@ | |||
| package com.iformall.domain.po; | |||
| import javax.persistence.Id; | |||
| import javax.persistence.Table; | |||
| import javax.persistence.Transient; | |||
| import java.io.Serializable; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| @Table(name = "wx_question") | |||
| public class WxQuestion implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| @Id | |||
| protected Long id; | |||
| @Transient | |||
| protected List<Long> ids; | |||
| @Transient | |||
| protected String sortColumns; | |||
| public Long getId() { | |||
| return id; | |||
| } | |||
| public void setId(Long id) { | |||
| this.id = id; | |||
| } | |||
| public String getSortColumns() { | |||
| return sortColumns; | |||
| } | |||
| public List<Long> getIds() { | |||
| return ids; | |||
| } | |||
| public void setIds(List<Long> ids) { | |||
| this.ids = ids; | |||
| } | |||
| /**租户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| /**问题**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="问题内容",name="content") | |||
| private String content; | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| public void setTenantId(String tenantId) { | |||
| this.tenantId = tenantId; | |||
| } | |||
| public String getContent() { | |||
| return content; | |||
| } | |||
| public void setContent(String content) { | |||
| this.content = content; | |||
| } | |||
| public enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| ,Name_ASC("`tenant_id` ASC"),Name_DESC("`tenant_id` DESC") | |||
| ,GroupId_ASC("`content` ASC"),GroupId_DESC("`content` DESC") | |||
| ; | |||
| private String value; | |||
| Field(String value){ | |||
| this.value = value; | |||
| } | |||
| public String getValue() { | |||
| return value; | |||
| } | |||
| public void setCol(String value) { | |||
| this.value = value; | |||
| } | |||
| @Override | |||
| public String toString() { | |||
| return this.getValue(); | |||
| } | |||
| } | |||
| public void setSortColumns(WxQuestion.Field... fields) | |||
| { | |||
| if (fields == null || fields.length == 0) { | |||
| return; | |||
| } | |||
| for (int k = 0; k < fields.length; k++) { | |||
| if (fields[k] == null) { | |||
| return; | |||
| } | |||
| } | |||
| StringBuilder sb = new StringBuilder(fields[0].toString()); | |||
| for (int k = 1; k < fields.length; k++) { | |||
| sb.append(","); | |||
| sb.append(fields[k].toString()); | |||
| } | |||
| this.sortColumns = sb.toString(); | |||
| } | |||
| public void setSortColumns(String sortColumns) | |||
| { | |||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | |||
| return; | |||
| } | |||
| if (sortColumns.contains(",")) { | |||
| String[] cols = sortColumns.split(","); | |||
| List<Field> fList = new ArrayList(); | |||
| for (int k = 0; k < cols.length; k++) { | |||
| fList.add(Field.valueOf(cols[k])); | |||
| } | |||
| this.setSortColumns(fList.toArray(new Field[fList.size()])); | |||
| } else { | |||
| this.setSortColumns(Field.valueOf(sortColumns)); | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,183 @@ | |||
| package com.iformall.domain.po; | |||
| import javax.persistence.Id; | |||
| import javax.persistence.Table; | |||
| import javax.persistence.Transient; | |||
| import java.io.Serializable; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @Table(name = "wx_question_config") | |||
| public class WxQuestionConfig implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| @Id | |||
| protected Long id; | |||
| @Transient | |||
| protected List<Long> ids; | |||
| @Transient | |||
| protected String sortColumns; | |||
| public Long getId() { | |||
| return id; | |||
| } | |||
| public void setId(Long id) { | |||
| this.id = id; | |||
| } | |||
| public String getSortColumns() { | |||
| return sortColumns; | |||
| } | |||
| public List<Long> getIds() { | |||
| return ids; | |||
| } | |||
| public void setIds(List<Long> ids) { | |||
| this.ids = ids; | |||
| } | |||
| /**租户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| /**问题列表**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="问题列表",name="questionList") | |||
| private String questionList; | |||
| /**附着卡券列表**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="附着卡券列表",name="couponTypeList") | |||
| private String couponTypeList; | |||
| /**创建时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime") | |||
| private Date createTime; | |||
| /**更新时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateTime") | |||
| private Date updateTime; | |||
| public Integer getStatus() { | |||
| return status; | |||
| } | |||
| public void setStatus(Integer status) { | |||
| this.status = status; | |||
| } | |||
| /**状态**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="状态",name="status") | |||
| private Integer status; | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| public void setTenantId(String tenantId) { | |||
| this.tenantId = tenantId; | |||
| } | |||
| public String getQuestionList() { | |||
| return questionList; | |||
| } | |||
| public void setQuestionList(String questionList) { | |||
| this.questionList = questionList; | |||
| } | |||
| public String getCouponTypeList() { | |||
| return couponTypeList; | |||
| } | |||
| public void setCouponTypeList(String couponTypeList) { | |||
| this.couponTypeList = couponTypeList; | |||
| } | |||
| public Date getCreateTime() { | |||
| return createTime; | |||
| } | |||
| public void setCreateTime(Date createTime) { | |||
| this.createTime = createTime; | |||
| } | |||
| public Date getUpdateTime() { | |||
| return updateTime; | |||
| } | |||
| public void setUpdateTime(Date updateTime) { | |||
| this.updateTime = updateTime; | |||
| } | |||
| @Transient | |||
| protected List<WxQuestion> questions; | |||
| public List<WxQuestion> getQuestions() { | |||
| return questions; | |||
| } | |||
| public void setQuestions(List<WxQuestion> questions) { | |||
| this.questions = questions; | |||
| } | |||
| public enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| ,Name_ASC("`tenant_id` ASC"),Name_DESC("`tenant_id` DESC") | |||
| ,CreateTime_ASC("`create_time` ASC"),CreateTime_DESC("`create_time` DESC") | |||
| ,UpdateTIme_ASC("`update_time` ASC"),UpdateTIme_DESC("`update_time` DESC") | |||
| ; | |||
| private String value; | |||
| Field(String value){ | |||
| this.value = value; | |||
| } | |||
| public String getValue() { | |||
| return value; | |||
| } | |||
| public void setCol(String value) { | |||
| this.value = value; | |||
| } | |||
| @Override | |||
| public String toString() { | |||
| return this.getValue(); | |||
| } | |||
| } | |||
| public void setSortColumns(WxQuestionConfig.Field... fields) | |||
| { | |||
| if (fields == null || fields.length == 0) { | |||
| return; | |||
| } | |||
| for (int k = 0; k < fields.length; k++) { | |||
| if (fields[k] == null) { | |||
| return; | |||
| } | |||
| } | |||
| StringBuilder sb = new StringBuilder(fields[0].toString()); | |||
| for (int k = 1; k < fields.length; k++) { | |||
| sb.append(","); | |||
| sb.append(fields[k].toString()); | |||
| } | |||
| this.sortColumns = sb.toString(); | |||
| } | |||
| public void setSortColumns(String sortColumns) | |||
| { | |||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | |||
| return; | |||
| } | |||
| if (sortColumns.contains(",")) { | |||
| String[] cols = sortColumns.split(","); | |||
| List<Field> fList = new ArrayList(); | |||
| for (int k = 0; k < cols.length; k++) { | |||
| fList.add(Field.valueOf(cols[k])); | |||
| } | |||
| this.setSortColumns(fList.toArray(new Field[fList.size()])); | |||
| } else { | |||
| this.setSortColumns(Field.valueOf(sortColumns)); | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,171 @@ | |||
| package com.iformall.domain.po; | |||
| import javax.persistence.Id; | |||
| import javax.persistence.Table; | |||
| import javax.persistence.Transient; | |||
| import java.io.Serializable; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @Table(name = "wx_question_log") | |||
| public class WxQuestionLog implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| @Id | |||
| protected Long id; | |||
| @Transient | |||
| protected List<Long> ids; | |||
| @Transient | |||
| protected String sortColumns; | |||
| public Long getId() { | |||
| return id; | |||
| } | |||
| public void setId(Long id) { | |||
| this.id = id; | |||
| } | |||
| public String getSortColumns() { | |||
| return sortColumns; | |||
| } | |||
| public List<Long> getIds() { | |||
| return ids; | |||
| } | |||
| public void setIds(List<Long> ids) { | |||
| this.ids = ids; | |||
| } | |||
| /**租户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| /**用户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="用户ID",name="userId") | |||
| private Long userId; | |||
| /**问题ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="问题ID",name="questionId") | |||
| private Long questionId; | |||
| /**答案**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="答案",name="answer") | |||
| private String answer; | |||
| /**创建时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime") | |||
| private Date createTime; | |||
| /**更新时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateTime") | |||
| private Date updateTime; | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| public void setTenantId(String tenantId) { | |||
| this.tenantId = tenantId; | |||
| } | |||
| public Long getUserId() { | |||
| return userId; | |||
| } | |||
| public void setUserId(Long userId) { | |||
| this.userId = userId; | |||
| } | |||
| public Long getQuestionId() { | |||
| return questionId; | |||
| } | |||
| public void setQuestionId(Long questionId) { | |||
| this.questionId = questionId; | |||
| } | |||
| public String getAnswer() { | |||
| return answer; | |||
| } | |||
| public void setAnswer(String answer) { | |||
| this.answer = answer; | |||
| } | |||
| public Date getCreateTime() { | |||
| return createTime; | |||
| } | |||
| public void setCreateTime(Date createTime) { | |||
| this.createTime = createTime; | |||
| } | |||
| public Date getUpdateTime() { | |||
| return updateTime; | |||
| } | |||
| public void setUpdateTime(Date updateTime) { | |||
| this.updateTime = updateTime; | |||
| } | |||
| public enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| ,TenantID_ASC("`tenant_id` ASC"),TenantID_DESC("`tenant_id` DESC") | |||
| ,UserId_ASC("`user_id` ASC"),UserId_DESC("`user_id` DESC") | |||
| ,QuestionId_ASC("`question_id` ASC"),QuestionId_DESC("`question_id` DESC") | |||
| ,Answer_ASC("`answer` ASC"),Answer_DESC("`answer` DESC") | |||
| ,CreateTime_ASC("`create_time` ASC"),CreateTime_DESC("`create_time` DESC") | |||
| ,UpdateTIme_ASC("`update_time` ASC"),UpdateTIme_DESC("`update_time` DESC") | |||
| ; | |||
| private String value; | |||
| Field(String value){ | |||
| this.value = value; | |||
| } | |||
| public String getValue() { | |||
| return value; | |||
| } | |||
| public void setCol(String value) { | |||
| this.value = value; | |||
| } | |||
| @Override | |||
| public String toString() { | |||
| return this.getValue(); | |||
| } | |||
| } | |||
| public void setSortColumns(WxQuestionLog.Field... fields) | |||
| { | |||
| if (fields == null || fields.length == 0) { | |||
| return; | |||
| } | |||
| for (int k = 0; k < fields.length; k++) { | |||
| if (fields[k] == null) { | |||
| return; | |||
| } | |||
| } | |||
| StringBuilder sb = new StringBuilder(fields[0].toString()); | |||
| for (int k = 1; k < fields.length; k++) { | |||
| sb.append(","); | |||
| sb.append(fields[k].toString()); | |||
| } | |||
| this.sortColumns = sb.toString(); | |||
| } | |||
| public void setSortColumns(String sortColumns) | |||
| { | |||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | |||
| return; | |||
| } | |||
| if (sortColumns.contains(",")) { | |||
| String[] cols = sortColumns.split(","); | |||
| List<Field> fList = new ArrayList(); | |||
| for (int k = 0; k < cols.length; k++) { | |||
| fList.add(Field.valueOf(cols[k])); | |||
| } | |||
| this.setSortColumns(fList.toArray(new Field[fList.size()])); | |||
| } else { | |||
| this.setSortColumns(Field.valueOf(sortColumns)); | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,37 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumQuestionConfigStatus { | |||
| // 1、开启 2:关闭 | |||
| ON(0,"开启"), | |||
| OFF(1, "关闭") | |||
| ; | |||
| public static EnumQuestionConfigStatus getEnum(Integer code) { | |||
| for (EnumQuestionConfigStatus value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumQuestionConfigStatus(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -0,0 +1,11 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxQuestionConfig; | |||
| import java.util.List; | |||
| public interface WxQuestionConfigMapper extends CommonMapper<WxQuestionConfig, String> { | |||
| List<WxQuestionConfig> findList(WxQuestionConfig wxQuestionConfig); | |||
| } | |||
| @@ -0,0 +1,11 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxQuestionLog; | |||
| import java.util.List; | |||
| public interface WxQuestionLogMapper extends CommonMapper<WxQuestionLog, String> { | |||
| List<WxQuestionLog> findList(WxQuestionLog wxQuestionLog); | |||
| } | |||
| @@ -0,0 +1,11 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxQuestion; | |||
| import java.util.List; | |||
| public interface WxQuestionMapper extends CommonMapper<WxQuestion, String> { | |||
| List<WxQuestion> findList(WxQuestion wxQuestion); | |||
| } | |||
| @@ -0,0 +1,50 @@ | |||
| package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxQuestion; | |||
| import com.iformall.domain.po.WxQuestionConfig; | |||
| import java.util.List; | |||
| public interface WxQuestionService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param offset | |||
| * @param limit | |||
| * @return | |||
| */ | |||
| PageInfo<WxQuestion> listAsPage(WxQuestion record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| WxQuestion getById(Long id); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(WxQuestion record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(Long id); | |||
| List<WxQuestion> findList(WxQuestion wxTags); | |||
| List<WxQuestionConfig> findConfigList(WxQuestionConfig wxQuestionConfig); | |||
| void saveOrUpdateConfig(WxQuestionConfig record); | |||
| } | |||
| @@ -27,6 +27,8 @@ import com.iformall.service.WxGameService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import com.iformall.common.IdWorker; | |||
| import org.springframework.transaction.annotation.Propagation; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| @Service | |||
| public class WxGameServiceImpl implements WxGameService { | |||
| @@ -121,6 +123,7 @@ public class WxGameServiceImpl implements WxGameService { | |||
| return game; | |||
| } | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| @Override | |||
| public void saveOrUpdate(WxGame record) { | |||
| if (record.getId() == null) { | |||
| @@ -0,0 +1,80 @@ | |||
| package com.iformall.service.impl; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.po.WxQuestion; | |||
| import com.iformall.domain.po.WxQuestionConfig; | |||
| import com.iformall.mapper.WxQuestionConfigMapper; | |||
| import com.iformall.mapper.WxQuestionLogMapper; | |||
| import com.iformall.mapper.WxQuestionMapper; | |||
| import com.iformall.service.WxQuestionService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.List; | |||
| @Service | |||
| public class WxQuestionServiceImpl implements WxQuestionService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| WxQuestionMapper wxQuestionMapper; | |||
| @Autowired | |||
| WxQuestionConfigMapper wxQuestionConfigMapper; | |||
| @Autowired | |||
| WxQuestionLogMapper wxQuestionLogMapper; | |||
| @Override | |||
| public PageInfo<WxQuestion> listAsPage(WxQuestion record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxQuestionMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public WxQuestion getById(Long id) { | |||
| return wxQuestionMapper.selectByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(WxQuestion record) { | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| wxQuestionMapper.insertSelective(record); | |||
| } else { | |||
| wxQuestionMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| wxQuestionMapper.deleteByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public List<WxQuestion> findList(WxQuestion wxQuestion) { | |||
| return wxQuestionMapper.findList(wxQuestion); | |||
| } | |||
| @Override | |||
| public List<WxQuestionConfig> findConfigList(WxQuestionConfig wxQuestionConfig) { | |||
| return wxQuestionConfigMapper.findList(wxQuestionConfig); | |||
| } | |||
| @Override | |||
| public void saveOrUpdateConfig(WxQuestionConfig record) { | |||
| if (record.getId() == null) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| wxQuestionConfigMapper.insertSelective(record); | |||
| } else { | |||
| wxQuestionConfigMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,65 @@ | |||
| <?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.iformall.mapper.WxQuestionConfigMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxQuestionConfig"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="question_list" jdbcType="VARCHAR" property="questionList"/> | |||
| <result column="coupon_type_list" jdbcType="VARCHAR" property="couponTypeList"/> | |||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | |||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> | |||
| <result column="status" jdbcType="INTEGER" property="status" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`question_list`,`coupon_type_list`,`create_time`,`update_time`,`status` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != questionList "> | |||
| and JSON_CONTAINS(`question_list`->'$',JSON_ARRAY(#{questionList})) | |||
| </if> | |||
| <if test=" null != couponTypeList "> | |||
| and JSON_CONTAINS(`coupon_type_list`->'$',JSON_ARRAY(#{couponTypeList})) | |||
| </if> | |||
| <if test=" null != createTime "> | |||
| and `create_time` = #{createTime} | |||
| </if> | |||
| <if test=" null != updateTime "> | |||
| and `update_time` = #{updateTime} | |||
| </if> | |||
| <if test=" null != status "> | |||
| and `status` = #{status} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxQuestionConfig" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_question_config | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| </mapper> | |||
| @@ -0,0 +1,70 @@ | |||
| <?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.iformall.mapper.WxQuestionLogMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxQuestionLog"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="user_id" jdbcType="BIGINT" property="userId"/> | |||
| <result column="question_id" jdbcType="BIGINT" property="questionId"/> | |||
| <result column="answer" jdbcType="VARCHAR" property="answer"/> | |||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | |||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`user_id`,`question_id`,`answer`,`create_time`,`update_time` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != userId "> | |||
| and `user_id` = #{userId} | |||
| </if> | |||
| <if test=" null != questionId "> | |||
| and `question_id` = #{questionId} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != answerId "> | |||
| and `answer` = #{answer} | |||
| </if> | |||
| <if test=" null != createTime "> | |||
| and `create_time` = #{createTime} | |||
| </if> | |||
| <if test=" null != updateTime "> | |||
| and `update_time` = #{updateTime} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxQuestionLog" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_question_log | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| </mapper> | |||
| @@ -0,0 +1,46 @@ | |||
| <?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.iformall.mapper.WxQuestionMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxQuestion"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="content" jdbcType="VARCHAR" property="content"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`content` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != content "> | |||
| and `content` = #{content} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxQuestion" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_question | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| </mapper> | |||