15 changed files with 901 additions and 10 deletions
@ -0,0 +1,121 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.dto; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 积分规则管理表 积分规则管理表 |
||||
|
* |
||||
|
* @author zhangyong |
||||
|
* @since v1.0.0 2020-04-28 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class PointsRuleDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* ID |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 积分规则编码 |
||||
|
*/ |
||||
|
private String ruleCode; |
||||
|
|
||||
|
/** |
||||
|
* 动作编码 |
||||
|
*/ |
||||
|
private String behaviorCode; |
||||
|
|
||||
|
/** |
||||
|
* 积分规则描述 |
||||
|
*/ |
||||
|
private String ruleDesc; |
||||
|
|
||||
|
/** |
||||
|
* 规则操作类型 0-减积分,1-加积分 |
||||
|
*/ |
||||
|
private String operationType; |
||||
|
|
||||
|
/** |
||||
|
* 积分规则值 |
||||
|
*/ |
||||
|
private Integer points; |
||||
|
|
||||
|
/** |
||||
|
* 上线统计指标 0-分钟,1-小时,2-日,3-月,4-年 |
||||
|
*/ |
||||
|
private String limitType; |
||||
|
|
||||
|
/** |
||||
|
* 积分上限值 |
||||
|
*/ |
||||
|
private Integer upperLimitVal; |
||||
|
|
||||
|
/** |
||||
|
* 启用标识 0-否,1-是 |
||||
|
*/ |
||||
|
private String enableFlag; |
||||
|
|
||||
|
/** |
||||
|
* 附加值 |
||||
|
*/ |
||||
|
private String addedVal; |
||||
|
|
||||
|
/** |
||||
|
* 备注 |
||||
|
*/ |
||||
|
private String remark; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识 0-否,1-是 |
||||
|
*/ |
||||
|
private String delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,31 @@ |
|||||
|
/** |
||||
|
* Copyright (c) 2018 人人开源 All rights reserved. |
||||
|
* <p> |
||||
|
* https://www.renren.io
|
||||
|
* <p> |
||||
|
* 版权所有,侵权必究! |
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc; |
||||
|
|
||||
|
import org.springframework.boot.SpringApplication; |
||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication; |
||||
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
||||
|
import org.springframework.cloud.openfeign.EnableFeignClients; |
||||
|
|
||||
|
/** |
||||
|
* 积分模块 |
||||
|
* |
||||
|
* @author zhangyong |
||||
|
* @date 2020/4/28 |
||||
|
*/ |
||||
|
@SpringBootApplication |
||||
|
@EnableDiscoveryClient |
||||
|
@EnableFeignClients |
||||
|
public class PointsApplication { |
||||
|
|
||||
|
public static void main(String[] args) { |
||||
|
SpringApplication.run(PointsApplication.class, args); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,26 @@ |
|||||
|
/** |
||||
|
* Copyright (c) 2018 人人开源 All rights reserved. |
||||
|
* <p> |
||||
|
* https://www.renren.io
|
||||
|
* <p> |
||||
|
* 版权所有,侵权必究! |
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.config; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.config.ModuleConfig; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
/** |
||||
|
* 模块配置信息-积分模块 |
||||
|
* |
||||
|
* @author zhangyong |
||||
|
* @since 1.0.0 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class ModuleConfigImpl implements ModuleConfig { |
||||
|
@Override |
||||
|
public String getName() { |
||||
|
return "points"; |
||||
|
} |
||||
|
} |
@ -0,0 +1,94 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.controller; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.AssertUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; |
||||
|
import com.elink.esua.epdc.dto.PointsRuleDTO; |
||||
|
import com.elink.esua.epdc.excel.PointsRuleExcel; |
||||
|
import com.elink.esua.epdc.service.PointsRuleService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 积分规则管理表 积分规则管理表 |
||||
|
* |
||||
|
* @author zhangyong |
||||
|
* @since v1.0.0 2020-04-28 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("pointsrule") |
||||
|
public class PointsRuleController { |
||||
|
|
||||
|
@Autowired |
||||
|
private PointsRuleService pointsRuleService; |
||||
|
|
||||
|
@GetMapping("page") |
||||
|
public Result<PageData<PointsRuleDTO>> page(@RequestParam Map<String, Object> params){ |
||||
|
PageData<PointsRuleDTO> page = pointsRuleService.page(params); |
||||
|
return new Result<PageData<PointsRuleDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("{id}") |
||||
|
public Result<PointsRuleDTO> get(@PathVariable("id") String id){ |
||||
|
PointsRuleDTO data = pointsRuleService.get(id); |
||||
|
return new Result<PointsRuleDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@PostMapping |
||||
|
public Result save(@RequestBody PointsRuleDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
pointsRuleService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PutMapping |
||||
|
public Result update(@RequestBody PointsRuleDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
pointsRuleService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping |
||||
|
public Result delete(@RequestBody String[] ids){ |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
pointsRuleService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("export") |
||||
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
||||
|
List<PointsRuleDTO> list = pointsRuleService.list(params); |
||||
|
ExcelUtils.exportExcelToTarget(response, null, list, PointsRuleExcel.class); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,33 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.dao; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
||||
|
import com.elink.esua.epdc.entity.PointsRuleEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
/** |
||||
|
* 积分规则管理表 积分规则管理表 |
||||
|
* |
||||
|
* @author zhangyong |
||||
|
* @since v1.0.0 2020-04-28 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface PointsRuleDao extends BaseDao<PointsRuleEntity> { |
||||
|
|
||||
|
} |
@ -0,0 +1,91 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 积分规则管理表 积分规则管理表 |
||||
|
* |
||||
|
* @author zhangyong |
||||
|
* @since v1.0.0 2020-04-28 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@TableName("epdc_points_rule") |
||||
|
public class PointsRuleEntity extends BaseEpdcEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 积分规则编码 |
||||
|
*/ |
||||
|
private String ruleCode; |
||||
|
|
||||
|
/** |
||||
|
* 动作编码 |
||||
|
*/ |
||||
|
private String behaviorCode; |
||||
|
|
||||
|
/** |
||||
|
* 积分规则描述 |
||||
|
*/ |
||||
|
private String ruleDesc; |
||||
|
|
||||
|
/** |
||||
|
* 规则操作类型 0-减积分,1-加积分 |
||||
|
*/ |
||||
|
private String operationType; |
||||
|
|
||||
|
/** |
||||
|
* 积分规则值 |
||||
|
*/ |
||||
|
private Integer points; |
||||
|
|
||||
|
/** |
||||
|
* 上线统计指标 0-分钟,1-小时,2-日,3-月,4-年 |
||||
|
*/ |
||||
|
private String limitType; |
||||
|
|
||||
|
/** |
||||
|
* 积分上限值 |
||||
|
*/ |
||||
|
private Integer upperLimitVal; |
||||
|
|
||||
|
/** |
||||
|
* 启用标识 0-否,1-是 |
||||
|
*/ |
||||
|
private String enableFlag; |
||||
|
|
||||
|
/** |
||||
|
* 附加值 |
||||
|
*/ |
||||
|
private String addedVal; |
||||
|
|
||||
|
/** |
||||
|
* 备注 |
||||
|
*/ |
||||
|
private String remark; |
||||
|
|
||||
|
} |
@ -0,0 +1,86 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.excel; |
||||
|
|
||||
|
import cn.afterturn.easypoi.excel.annotation.Excel; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 积分规则管理表 积分规则管理表 |
||||
|
* |
||||
|
* @author zhangyong |
||||
|
* @since v1.0.0 2020-04-28 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class PointsRuleExcel { |
||||
|
|
||||
|
@Excel(name = "ID") |
||||
|
private String id; |
||||
|
|
||||
|
@Excel(name = "积分规则编码") |
||||
|
private String ruleCode; |
||||
|
|
||||
|
@Excel(name = "动作编码") |
||||
|
private String behaviorCode; |
||||
|
|
||||
|
@Excel(name = "积分规则描述") |
||||
|
private String ruleDesc; |
||||
|
|
||||
|
@Excel(name = "规则操作类型 0-减积分,1-加积分") |
||||
|
private String operationType; |
||||
|
|
||||
|
@Excel(name = "积分规则值") |
||||
|
private Integer points; |
||||
|
|
||||
|
@Excel(name = "上线统计指标 0-分钟,1-小时,2-日,3-月,4-年") |
||||
|
private String limitType; |
||||
|
|
||||
|
@Excel(name = "积分上限值") |
||||
|
private Integer upperLimitVal; |
||||
|
|
||||
|
@Excel(name = "启用标识 0-否,1-是") |
||||
|
private String enableFlag; |
||||
|
|
||||
|
@Excel(name = "附加值") |
||||
|
private String addedVal; |
||||
|
|
||||
|
@Excel(name = "备注") |
||||
|
private String remark; |
||||
|
|
||||
|
@Excel(name = "乐观锁") |
||||
|
private Integer revision; |
||||
|
|
||||
|
@Excel(name = "删除标识 0-否,1-是") |
||||
|
private String delFlag; |
||||
|
|
||||
|
@Excel(name = "创建人") |
||||
|
private String createdBy; |
||||
|
|
||||
|
@Excel(name = "创建时间") |
||||
|
private Date createdTime; |
||||
|
|
||||
|
@Excel(name = "更新人") |
||||
|
private String updatedBy; |
||||
|
|
||||
|
@Excel(name = "更新时间") |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,47 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.redis; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.redis.RedisUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* 积分规则管理表 积分规则管理表 |
||||
|
* |
||||
|
* @author zhangyong |
||||
|
* @since v1.0.0 2020-04-28 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class PointsRuleRedis { |
||||
|
@Autowired |
||||
|
private RedisUtils redisUtils; |
||||
|
|
||||
|
public void delete(Object[] ids) { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public void set(){ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public String get(String id){ |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,95 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.service; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.mybatis.service.BaseService; |
||||
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
||||
|
import com.elink.esua.epdc.dto.PointsRuleDTO; |
||||
|
import com.elink.esua.epdc.entity.PointsRuleEntity; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 积分规则管理表 积分规则管理表 |
||||
|
* |
||||
|
* @author zhangyong |
||||
|
* @since v1.0.0 2020-04-28 |
||||
|
*/ |
||||
|
public interface PointsRuleService extends BaseService<PointsRuleEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 默认分页 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return PageData<PointsRuleDTO> |
||||
|
* @author generator |
||||
|
* @date 2020-04-28 |
||||
|
*/ |
||||
|
PageData<PointsRuleDTO> page(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 默认查询 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return java.util.List<PointsRuleDTO> |
||||
|
* @author generator |
||||
|
* @date 2020-04-28 |
||||
|
*/ |
||||
|
List<PointsRuleDTO> list(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 单条查询 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return PointsRuleDTO |
||||
|
* @author generator |
||||
|
* @date 2020-04-28 |
||||
|
*/ |
||||
|
PointsRuleDTO get(String id); |
||||
|
|
||||
|
/** |
||||
|
* 默认保存 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2020-04-28 |
||||
|
*/ |
||||
|
void save(PointsRuleDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 默认更新 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2020-04-28 |
||||
|
*/ |
||||
|
void update(PointsRuleDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除 |
||||
|
* |
||||
|
* @param ids |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2020-04-28 |
||||
|
*/ |
||||
|
void delete(String[] ids); |
||||
|
} |
@ -0,0 +1,104 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
||||
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
||||
|
import com.elink.esua.epdc.dao.PointsRuleDao; |
||||
|
import com.elink.esua.epdc.dto.PointsRuleDTO; |
||||
|
import com.elink.esua.epdc.entity.PointsRuleEntity; |
||||
|
import com.elink.esua.epdc.redis.PointsRuleRedis; |
||||
|
import com.elink.esua.epdc.service.PointsRuleService; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 积分规则管理表 积分规则管理表 |
||||
|
* |
||||
|
* @author zhangyong |
||||
|
* @since v1.0.0 2020-04-28 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class PointsRuleServiceImpl extends BaseServiceImpl<PointsRuleDao, PointsRuleEntity> implements PointsRuleService { |
||||
|
|
||||
|
@Autowired |
||||
|
private PointsRuleRedis pointsRuleRedis; |
||||
|
|
||||
|
@Override |
||||
|
public PageData<PointsRuleDTO> page(Map<String, Object> params) { |
||||
|
IPage<PointsRuleEntity> page = baseDao.selectPage( |
||||
|
getPage(params, FieldConstant.CREATED_TIME, false), |
||||
|
getWrapper(params) |
||||
|
); |
||||
|
return getPageData(page, PointsRuleDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<PointsRuleDTO> list(Map<String, Object> params) { |
||||
|
List<PointsRuleEntity> entityList = baseDao.selectList(getWrapper(params)); |
||||
|
|
||||
|
return ConvertUtils.sourceToTarget(entityList, PointsRuleDTO.class); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<PointsRuleEntity> getWrapper(Map<String, Object> params){ |
||||
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
||||
|
|
||||
|
QueryWrapper<PointsRuleEntity> wrapper = new QueryWrapper<>(); |
||||
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
||||
|
|
||||
|
return wrapper; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public PointsRuleDTO get(String id) { |
||||
|
PointsRuleEntity entity = baseDao.selectById(id); |
||||
|
return ConvertUtils.sourceToTarget(entity, PointsRuleDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void save(PointsRuleDTO dto) { |
||||
|
PointsRuleEntity entity = ConvertUtils.sourceToTarget(dto, PointsRuleEntity.class); |
||||
|
insert(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void update(PointsRuleDTO dto) { |
||||
|
PointsRuleEntity entity = ConvertUtils.sourceToTarget(dto, PointsRuleEntity.class); |
||||
|
updateById(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void delete(String[] ids) { |
||||
|
// 逻辑删除(@TableLogic 注解)
|
||||
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
<?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.elink.esua.epdc.dao.PointsRuleDao"> |
||||
|
|
||||
|
<resultMap type="com.elink.esua.epdc.entity.PointsRuleEntity" id="pointsRuleMap"> |
||||
|
<result property="id" column="ID"/> |
||||
|
<result property="ruleCode" column="RULE_CODE"/> |
||||
|
<result property="behaviorCode" column="BEHAVIOR_CODE"/> |
||||
|
<result property="ruleDesc" column="RULE_DESC"/> |
||||
|
<result property="operationType" column="OPERATION_TYPE"/> |
||||
|
<result property="points" column="POINTS"/> |
||||
|
<result property="limitType" column="LIMIT_TYPE"/> |
||||
|
<result property="upperLimitVal" column="UPPER_LIMIT_VAL"/> |
||||
|
<result property="enableFlag" column="ENABLE_FLAG"/> |
||||
|
<result property="addedVal" column="ADDED_VAL"/> |
||||
|
<result property="remark" column="REMARK"/> |
||||
|
<result property="revision" column="REVISION"/> |
||||
|
<result property="delFlag" column="DEL_FLAG"/> |
||||
|
<result property="createdBy" column="CREATED_BY"/> |
||||
|
<result property="createdTime" column="CREATED_TIME"/> |
||||
|
<result property="updatedBy" column="UPDATED_BY"/> |
||||
|
<result property="updatedTime" column="UPDATED_TIME"/> |
||||
|
</resultMap> |
||||
|
|
||||
|
|
||||
|
</mapper> |
Loading…
Reference in new issue