| @@ -1,5 +1,7 @@ | |||||
| package com.iformall.domain.po; | package com.iformall.domain.po; | ||||
| import lombok.Data; | |||||
| import javax.persistence.*; | import javax.persistence.*; | ||||
| import java.util.*; | import java.util.*; | ||||
| import javax.persistence.Transient; | import javax.persistence.Transient; | ||||
| @@ -8,6 +10,7 @@ import javax.persistence.Id; | |||||
| import java.io.Serializable; | import java.io.Serializable; | ||||
| @Table(name = "wx_coupon_send_config") | @Table(name = "wx_coupon_send_config") | ||||
| @Data | |||||
| public class WxCouponSendConfig implements Serializable { | public class WxCouponSendConfig implements Serializable { | ||||
| private static final long serialVersionUID = 1L; | private static final long serialVersionUID = 1L; | ||||
| @@ -18,88 +21,24 @@ public class WxCouponSendConfig implements Serializable { | |||||
| protected List<Long> ids; | protected List<Long> ids; | ||||
| @Transient | @Transient | ||||
| protected String sortColumns; | 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") | @io.swagger.annotations.ApiModelProperty(value="租户id",name="tenantId") | ||||
| private String tenantId; | private String tenantId; | ||||
| /*配置**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="配置",name="sendType") | |||||
| @io.swagger.annotations.ApiModelProperty(value="配置(2:停车发券 3:核销发券 4: B端刷卡发券)",name="sendType") | |||||
| private Integer sendType; | private Integer sendType; | ||||
| /*0:启用 1:停用**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="0:启用 1:停用",name="value") | @io.swagger.annotations.ApiModelProperty(value="0:启用 1:停用",name="value") | ||||
| private Integer value; | private Integer value; | ||||
| /*备注**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="备注",name="remark") | @io.swagger.annotations.ApiModelProperty(value="备注",name="remark") | ||||
| private String remark; | private String remark; | ||||
| /*创建时间**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime") | @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime") | ||||
| private Date createTime; | private Date createTime; | ||||
| /*修改时间**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="修改时间",name="updateTime") | @io.swagger.annotations.ApiModelProperty(value="修改时间",name="updateTime") | ||||
| private Date updateTime; | private Date updateTime; | ||||
| public String getTenantId() { | |||||
| return tenantId; | |||||
| } | |||||
| public void setTenantId(String _tenantId) { | |||||
| tenantId = _tenantId; | |||||
| } | |||||
| public Integer getSendType() { | |||||
| return sendType; | |||||
| } | |||||
| public void setSendType(Integer _sendType) { | |||||
| sendType = _sendType; | |||||
| } | |||||
| public Integer getValue() { | |||||
| return value; | |||||
| } | |||||
| public void setValue(Integer _value) { | |||||
| value = _value; | |||||
| } | |||||
| public String getRemark() { | |||||
| return remark; | |||||
| } | |||||
| public void setRemark(String _remark) { | |||||
| remark = _remark; | |||||
| } | |||||
| public Date getCreateTime() { | |||||
| return createTime; | |||||
| } | |||||
| public void setCreateTime(Date _createTime) { | |||||
| createTime = _createTime; | |||||
| } | |||||
| public Date getUpdateTime() { | |||||
| return updateTime; | |||||
| } | |||||
| public void setUpdateTime(Date _updateTime) { | |||||
| updateTime = _updateTime; | |||||
| } | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||||
| ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") | |||||
| ,SendType_ASC("`send_type` ASC"),SendType_DESC("`send_type` DESC") | ,SendType_ASC("`send_type` ASC"),SendType_DESC("`send_type` DESC") | ||||
| ,Value_ASC("`value` ASC"),Value_DESC("`value` DESC") | ,Value_ASC("`value` ASC"),Value_DESC("`value` DESC") | ||||
| ,Remark_ASC("`remark` ASC"),Remark_DESC("`remark` DESC") | ,Remark_ASC("`remark` ASC"),Remark_DESC("`remark` DESC") | ||||
| @@ -137,7 +76,7 @@ public class WxCouponSendConfig implements Serializable { | |||||
| sb.append(","); | sb.append(","); | ||||
| sb.append(fields[k].toString()); | sb.append(fields[k].toString()); | ||||
| } | } | ||||
| this.sortColumns = sb.toString(); | |||||
| } | } | ||||
| public void setSortColumns(String sortColumns) | public void setSortColumns(String sortColumns) | ||||
| @@ -9,13 +9,34 @@ public interface WxCouponSendConfigService { | |||||
| * 根据实体查询分页列表 | * 根据实体查询分页列表 | ||||
| * | * | ||||
| * @param record | * @param record | ||||
| * @param offset | |||||
| * @param limit | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| PageInfo<WxCouponSendConfig> listAsPage(WxCouponSendConfig record, Integer pageIndex, Integer pageSize); | PageInfo<WxCouponSendConfig> listAsPage(WxCouponSendConfig record, Integer pageIndex, Integer pageSize); | ||||
| /** | |||||
| * 根据Id获得实体 | |||||
| * | |||||
| * @param id | |||||
| * @return | |||||
| */ | |||||
| WxCouponSendConfig getById(Long id); | |||||
| /** | |||||
| * 保存或更新实体 | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| void saveOrUpdate(WxCouponSendConfig record); | |||||
| /** | |||||
| * 根据Id删除实体 | |||||
| * | |||||
| * @param id | |||||
| */ | |||||
| void deleteById(Long id); | |||||
| /** | /** | ||||
| * 保存或更新实体 | * 保存或更新实体 | ||||
| * | * | ||||
| @@ -2,6 +2,7 @@ package com.iformall.service.impl; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.IdWorker; | |||||
| import com.iformall.domain.po.WxCouponSendConfig; | import com.iformall.domain.po.WxCouponSendConfig; | ||||
| import com.iformall.mapper.WxCouponSendConfigMapper; | import com.iformall.mapper.WxCouponSendConfigMapper; | ||||
| import com.iformall.service.WxCouponSendConfigService; | import com.iformall.service.WxCouponSendConfigService; | ||||
| @@ -24,6 +25,27 @@ public class WxCouponSendConfigServiceImpl implements WxCouponSendConfigService | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponSendConfigMapper.findList(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponSendConfigMapper.findList(record)); | ||||
| } | } | ||||
| @Override | |||||
| public WxCouponSendConfig getById(Long id) { | |||||
| return wxCouponSendConfigMapper.selectByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public void saveOrUpdate(WxCouponSendConfig record) { | |||||
| if (record.getId() == null) { | |||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | |||||
| wxCouponSendConfigMapper.insertSelective(record); | |||||
| } else { | |||||
| wxCouponSendConfigMapper.updateByPrimaryKeySelective(record); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void deleteById(Long id) { | |||||
| wxCouponSendConfigMapper.deleteByPrimaryKey(id); | |||||
| } | |||||
| @Override | @Override | ||||
| public void update(WxCouponSendConfig record) { | public void update(WxCouponSendConfig record) { | ||||
| @@ -0,0 +1,69 @@ | |||||
| package com.iformall.controller.basic; | |||||
| import com.iformall.controller.base.BaseController; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.WxCouponSendConfig; | |||||
| import com.iformall.service.WxCouponSendConfigService; | |||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| @RestController | |||||
| @RequestMapping("wxCouponSendConfig") | |||||
| public class WxCouponSendConfigController extends BaseController { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| private WxCouponSendConfigService wxCouponSendConfigService; | |||||
| @ApiOperation("分页列表接口") | |||||
| @GetMapping("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 WxCouponSendConfig wxCouponSendConfig, Integer pageNum, Integer pageSize) { | |||||
| if (null == wxCouponSendConfig) wxCouponSendConfig = new WxCouponSendConfig(); | |||||
| final PageInfo<WxCouponSendConfig> page = wxCouponSendConfigService.listAsPage(wxCouponSendConfig, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @ApiOperation("新增接口(2)") | |||||
| @PostMapping("add") | |||||
| public ResultData add(@RequestBody WxCouponSendConfig wxCouponSendConfig) { | |||||
| //Assert.notNull(wxCouponSendConfig.getName(), "角色名不能为空"); | |||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||||
| wxCouponSendConfigService.saveOrUpdate(wxCouponSendConfig); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("根据id更新接口") | |||||
| @PostMapping("update") | |||||
| public ResultData update(@RequestBody WxCouponSendConfig wxCouponSendConfig) { | |||||
| wxCouponSendConfigService.saveOrUpdate(wxCouponSendConfig); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("根据id删除接口") | |||||
| @GetMapping("/del") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| public ResultData delete(Long id) { | |||||
| wxCouponSendConfigService.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, "查询成功", wxCouponSendConfigService.getById(id)); | |||||
| } | |||||
| } | |||||