| @@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.RestController; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.dto.WxLevelConfigDto; | |||
| import com.simple.domain.po.WxLevelConfig; | |||
| import com.simple.service.WxLevelConfigService; | |||
| @@ -43,20 +44,32 @@ public class WxLevelConfigController extends BaseController | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxLevelConfig wxLevelConfig) { | |||
| public ResultData add(@RequestBody WxLevelConfigDto dto) { | |||
| //Assert.notNull(wxLevelConfig.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxLevelConfig.setTenantId(getTenantId()); | |||
| wxLevelConfigService.saveOrUpdate(wxLevelConfig); | |||
| String[] points = dto.getPoints().split("|"); | |||
| String[] level = dto.getLevel().split("|"); | |||
| String[] descs =dto.getDescription().split("|"); | |||
| String tenantId = getTenantId(); | |||
| wxLevelConfigService.deleteAll(); | |||
| for(int i=0;i<points.length;i++) { | |||
| WxLevelConfig wxLevelConfig = new WxLevelConfig(); | |||
| wxLevelConfig.setTenantId(tenantId); | |||
| wxLevelConfig.setPoints(Integer.parseInt(points[i])); | |||
| wxLevelConfig.setLevel(level[i]); | |||
| wxLevelConfig.setDescription(descs[i]); | |||
| wxLevelConfigService.saveOrUpdate(wxLevelConfig); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxLevelConfig wxLevelConfig) { | |||
| wxLevelConfigService.saveOrUpdate(wxLevelConfig); | |||
| return new ResultData(); | |||
| } | |||
| // @ApiOperation("根据id更新接口") | |||
| // @PostMapping("update") | |||
| // public ResultData update(@RequestBody WxLevelConfig wxLevelConfig) { | |||
| // wxLevelConfig.setTenantId(getTenantId()); | |||
| // wxLevelConfigService.saveOrUpdate(wxLevelConfig); | |||
| // return new ResultData(); | |||
| // } | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @@ -0,0 +1,45 @@ | |||
| package com.simple.domain.dto; | |||
| import java.io.Serializable; | |||
| /** | |||
| * 等级权益dto | |||
| * @author jinguo | |||
| * | |||
| */ | |||
| public class WxLevelConfigDto implements Serializable{ | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = -8155943956044066653L; | |||
| /*成长值**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="成长值",name="points") | |||
| private String points; | |||
| /*等级**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="等级",name="level") | |||
| private String level; | |||
| /*描述**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="描述",name="description") | |||
| private String description; | |||
| public String getPoints() { | |||
| return points; | |||
| } | |||
| public void setPoints(String points) { | |||
| this.points = points; | |||
| } | |||
| public String getLevel() { | |||
| return level; | |||
| } | |||
| public void setLevel(String level) { | |||
| this.level = level; | |||
| } | |||
| public String getDescription() { | |||
| return description; | |||
| } | |||
| public void setDescription(String description) { | |||
| this.description = description; | |||
| } | |||
| } | |||
| @@ -48,9 +48,9 @@ public class WxScoreRules implements Serializable { | |||
| /*消费金额**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="消费金额",name="consumptionAmount") | |||
| private Integer consumptionAmount; | |||
| /*获取积分**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="获取积分",name="scoreNumber") | |||
| private Integer scoreNumber; | |||
| /*登录获取积分**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="登录获取积分",name="loginScoreNumber") | |||
| private Integer loginScoreNumber; | |||
| /*创建时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| @@ -60,9 +60,9 @@ public class WxScoreRules implements Serializable { | |||
| /*登录次数**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="登录次数",name="loginCount") | |||
| private Integer loginCount; | |||
| /*类型:0 消费金额 1登录次数**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="类型:0 消费金额 1登录次数",name="type") | |||
| private Integer type; | |||
| /*消费获取积分**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="消费获取积分",name="consumptionScoreNumber") | |||
| private Integer consumptionScoreNumber; | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| @@ -75,11 +75,11 @@ public class WxScoreRules implements Serializable { | |||
| public void setConsumptionAmount(Integer _consumptionAmount) { | |||
| consumptionAmount = _consumptionAmount; | |||
| } | |||
| public Integer getScoreNumber() { | |||
| return scoreNumber; | |||
| public Integer getLoginScoreNumber() { | |||
| return loginScoreNumber; | |||
| } | |||
| public void setScoreNumber(Integer _scoreNumber) { | |||
| scoreNumber = _scoreNumber; | |||
| public void setLoginScoreNumber(Integer _loginScoreNumber) { | |||
| loginScoreNumber = _loginScoreNumber; | |||
| } | |||
| public Date getCreateDate() { | |||
| return createDate; | |||
| @@ -99,11 +99,11 @@ public class WxScoreRules implements Serializable { | |||
| public void setLoginCount(Integer _loginCount) { | |||
| loginCount = _loginCount; | |||
| } | |||
| public Integer getType() { | |||
| return type; | |||
| public Integer getConsumptionScoreNumber() { | |||
| return consumptionScoreNumber; | |||
| } | |||
| public void setType(Integer _type) { | |||
| type = _type; | |||
| public void setConsumptionScoreNumber(Integer _consumptionScoreNumber) { | |||
| consumptionScoreNumber = _consumptionScoreNumber; | |||
| } | |||
| @@ -113,11 +113,11 @@ public class WxScoreRules implements Serializable { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||
| ,ConsumptionAmount_ASC("`consumptionAmount` ASC"),ConsumptionAmount_DESC("`consumptionAmount` DESC") | |||
| ,ScoreNumber_ASC("`scoreNumber` ASC"),ScoreNumber_DESC("`scoreNumber` DESC") | |||
| ,LoginScoreNumber_ASC("`loginScoreNumber` ASC"),LoginScoreNumber_DESC("`loginScoreNumber` DESC") | |||
| ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") | |||
| ,UpdateDate_ASC("`updateDate` ASC"),UpdateDate_DESC("`updateDate` DESC") | |||
| ,LoginCount_ASC("`loginCount` ASC"),LoginCount_DESC("`loginCount` DESC") | |||
| ,Type_ASC("`type` ASC"),Type_DESC("`type` DESC") | |||
| ,ConsumptionScoreNumber_ASC("`consumptionScoreNumber` ASC"),ConsumptionScoreNumber_DESC("`consumptionScoreNumber` DESC") | |||
| ; | |||
| private String value; | |||
| Field(String value){ | |||
| @@ -10,7 +10,7 @@ public interface WxLevelConfigMapper extends CommonMapper<WxLevelConfig, Long> { | |||
| List<WxLevelConfig> findList(WxLevelConfig wxLevelConfig); | |||
| void deleteAll(); | |||
| @@ -1,6 +1,5 @@ | |||
| package com.simple.service; | |||
| import java.util.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.domain.po.WxLevelConfig; | |||
| @@ -39,7 +38,7 @@ public interface WxLevelConfigService { | |||
| void deleteById(Long id); | |||
| void deleteAll(); | |||
| @@ -43,6 +43,12 @@ public class WxLevelConfigServiceImpl implements WxLevelConfigService { | |||
| public void deleteById(Long id) { | |||
| wxLevelConfigMapper.deleteByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public void deleteAll() { | |||
| wxLevelConfigMapper.deleteAll(); | |||
| } | |||
| @@ -60,8 +60,9 @@ | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <delete id="deleteAll"> | |||
| delete from wx_level_config; | |||
| </delete> | |||
| @@ -5,15 +5,15 @@ | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="consumption_amount" jdbcType="INTEGER" property="consumptionAmount" /> | |||
| <result column="score_number" jdbcType="INTEGER" property="scoreNumber" /> | |||
| <result column="login_score_number" jdbcType="INTEGER" property="loginScoreNumber" /> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | |||
| <result column="login_count" jdbcType="INTEGER" property="loginCount" /> | |||
| <result column="type" jdbcType="INTEGER" property="type" /> | |||
| <result column="consumption_score_number" jdbcType="INTEGER" property="consumptionScoreNumber" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`consumption_amount`,`score_number`,`create_date`,`update_date`,`login_count`,`type` | |||
| `id`,`tenant_id`,`consumption_amount`,`login_score_number`,`create_date`,`update_date`,`login_count`,`consumption_score_number` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -34,8 +34,8 @@ | |||
| </if> | |||
| <if test=" null != scoreNumber "> | |||
| and `score_number` = #{scoreNumber} | |||
| <if test=" null != loginScoreNumber "> | |||
| and `login_score_number` = #{loginScoreNumber} | |||
| </if> | |||
| @@ -54,8 +54,8 @@ | |||
| </if> | |||
| <if test=" null != type "> | |||
| and `type` = #{type} | |||
| <if test=" null != consumptionScoreNumber "> | |||
| and `consumption_score_number` = #{consumptionScoreNumber} | |||
| </if> | |||
| <if test=" null != ids "> | |||