| @@ -3,6 +3,7 @@ package com.iformall.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxCUser; | |||
| import com.iformall.domain.po.WxScoreHistory; | |||
| import com.iformall.service.WxScoreHistoryService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| @@ -22,46 +23,19 @@ public class WxScoreHistoryController extends BaseController { | |||
| private WxScoreHistoryService wxScoreHistoryService; | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @PostMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxScoreHistory wxScoreHistory, Integer pageNum, Integer pageSize) { | |||
| if (null == wxScoreHistory) wxScoreHistory = new WxScoreHistory(); | |||
| public ResultData list(Integer pageNum, Integer pageSize) { | |||
| WxCUser user = getUser(); | |||
| WxScoreHistory wxScoreHistory = new WxScoreHistory(); | |||
| wxScoreHistory.setTenantId(user.getTenantId()); | |||
| wxScoreHistory.setCUserId(user.getId()); | |||
| wxScoreHistory.setSortColumns(WxScoreHistory.Field.CreateDate_DESC); | |||
| final PageInfo<WxScoreHistory> page = wxScoreHistoryService.listAsPage(wxScoreHistory, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxScoreHistory wxScoreHistory) { | |||
| //Assert.notNull(wxScoreHistory.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxScoreHistoryService.saveOrUpdate(wxScoreHistory); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxScoreHistory wxScoreHistory) { | |||
| wxScoreHistoryService.saveOrUpdate(wxScoreHistory); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxScoreHistoryService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxScoreHistoryService.getById(id)); | |||
| } | |||
| } | |||
| @@ -1,5 +1,7 @@ | |||
| package com.iformall.domain.po; | |||
| import lombok.Data; | |||
| import javax.persistence.*; | |||
| import java.util.*; | |||
| import java.math.*; | |||
| @@ -9,6 +11,7 @@ import javax.persistence.Id; | |||
| import java.io.Serializable; | |||
| @Table(name = "wx_score_history") | |||
| @Data | |||
| public class WxScoreHistory implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| @@ -19,26 +22,6 @@ public class WxScoreHistory implements Serializable { | |||
| protected List<String> 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<String> getIds() { | |||
| return ids; | |||
| } | |||
| public void setIds(List<String> ids) { | |||
| this.ids = ids; | |||
| } | |||
| /**租户ID**/ | |||
| @@ -72,71 +55,13 @@ public class WxScoreHistory implements Serializable { | |||
| @io.swagger.annotations.ApiModelProperty(value="扣减原因",name="reason") | |||
| private String reason; | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| public void setTenantId(String _tenantId) { | |||
| tenantId = _tenantId; | |||
| } | |||
| public Long getCUserId() { | |||
| return cUserId; | |||
| } | |||
| public void setCUserId(Long _cUserId) { | |||
| cUserId = _cUserId; | |||
| } | |||
| public Date getCreateDate() { | |||
| return createDate; | |||
| } | |||
| public void setCreateDate(Date _createDate) { | |||
| createDate = _createDate; | |||
| } | |||
| public Integer getScoreType() { | |||
| return scoreType; | |||
| } | |||
| @Transient | |||
| @io.swagger.annotations.ApiModelProperty(value="开始时间",name="startdate") | |||
| private Date startdate; | |||
| public void setScoreType(Integer scoreType) { | |||
| this.scoreType = scoreType; | |||
| } | |||
| public Date getValidDate() { | |||
| return validDate; | |||
| } | |||
| public void setValidDate(Date _validDate) { | |||
| validDate = _validDate; | |||
| } | |||
| public Long getOrderId() { | |||
| return orderId; | |||
| } | |||
| public void setOrderId(Long _orderId) { | |||
| orderId = _orderId; | |||
| } | |||
| public Integer getPayType() { | |||
| return payType; | |||
| } | |||
| public void setPayType(Integer _payType) { | |||
| payType = _payType; | |||
| } | |||
| public Integer getPayAmount() { | |||
| return payAmount; | |||
| } | |||
| public void setPayAmount(Integer _payAmount) { | |||
| payAmount = _payAmount; | |||
| } | |||
| public Integer getScoreAmount() { | |||
| return scoreAmount; | |||
| } | |||
| public void setScoreAmount(Integer _scoreAmount) { | |||
| scoreAmount = _scoreAmount; | |||
| } | |||
| public String getReason() { | |||
| return reason; | |||
| } | |||
| public void setReason(String reason) { | |||
| this.reason = reason; | |||
| } | |||
| @Transient | |||
| @io.swagger.annotations.ApiModelProperty(value="结束时间",name="enddate") | |||
| private Date enddate; | |||
| public static enum Field | |||
| { | |||
| @@ -64,6 +64,9 @@ | |||
| <if test=" null != reason "> | |||
| and `reason` = #{reason} | |||
| </if> | |||
| <if test=" null != startdate and null!=enddate"> | |||
| and `create_date` between #{startdate} and #{enddate} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||