| @@ -32,13 +32,10 @@ public class PushLimitController extends BaseController | |||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @GetMapping("list") | @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 PushLimit pushLimit, Integer pageNum, Integer pageSize) { | |||||
| public ResultData list(@ModelAttribute PushLimit pushLimit) { | |||||
| if (null == pushLimit) pushLimit = new PushLimit(); | if (null == pushLimit) pushLimit = new PushLimit(); | ||||
| pushLimit.setTenantId(getTenantId()); | pushLimit.setTenantId(getTenantId()); | ||||
| final PageInfo<PushLimit> page = pushLimitService.listAsPage(pushLimit, pageNum, pageSize); | |||||
| final PageInfo<PushLimit> page = pushLimitService.listAsPage(pushLimit, 1, 10); | |||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @@ -0,0 +1,125 @@ | |||||
| package com.simple.controller; | |||||
| import org.apache.log4j.Logger; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.GetMapping; | |||||
| import org.springframework.web.bind.annotation.PostMapping; | |||||
| import org.springframework.web.bind.annotation.RequestBody; | |||||
| import org.springframework.web.bind.annotation.RequestMapping; | |||||
| import org.springframework.web.bind.annotation.RestController; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.simple.common.ResultData; | |||||
| import com.simple.domain.po.WxMallConfig; | |||||
| import com.simple.service.WxMallConfigService; | |||||
| import io.swagger.annotations.Api; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| @RestController | |||||
| @RequestMapping("wxMallConfig") | |||||
| @Api(description="停车发券和精准发劵接口") | |||||
| public class WxMallConfigController extends BaseController | |||||
| { | |||||
| @Autowired | |||||
| private WxMallConfigService wxMallConfigService; | |||||
| private Logger logger = Logger.getLogger(WxMallConfigController.class); | |||||
| @ApiOperation("获取停车劵开关") | |||||
| @GetMapping("getStopCarConpon") | |||||
| public ResultData getStopCarConpon() { | |||||
| WxMallConfig wxMallConfig = new WxMallConfig(); | |||||
| wxMallConfig.setKey("stopCarCouponSwitch"); | |||||
| wxMallConfig.setTenantId(getTenantId()); | |||||
| PageInfo<WxMallConfig> page = wxMallConfigService.listAsPage(wxMallConfig, 1, 1); | |||||
| if(page.getSize()>0) { | |||||
| WxMallConfig config = page.getList().get(0); | |||||
| return new ResultData(config); | |||||
| } | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("获取核销劵开关") | |||||
| @GetMapping("getVerifyConpon") | |||||
| public ResultData getVerifyConpon() { | |||||
| WxMallConfig wxMallConfig = new WxMallConfig(); | |||||
| wxMallConfig.setKey("verifyConponSwitch"); | |||||
| wxMallConfig.setTenantId(getTenantId()); | |||||
| PageInfo<WxMallConfig> page = wxMallConfigService.listAsPage(wxMallConfig, 1, 1); | |||||
| if(page.getSize()>0) { | |||||
| WxMallConfig config = page.getList().get(0); | |||||
| return new ResultData(config); | |||||
| } | |||||
| return new ResultData(); | |||||
| } | |||||
| @PostMapping("updateStopCarConpon") | |||||
| @ApiOperation("修改核销开关") | |||||
| public ResultData updateStopCarConpon(@RequestBody WxMallConfig wxMallConfig) { | |||||
| WxMallConfig temp = new WxMallConfig(); | |||||
| temp.setKey("stopCarCouponSwitch"); | |||||
| temp.setTenantId(getTenantId()); | |||||
| temp.setValue(wxMallConfig.getValue()); | |||||
| temp.setId(wxMallConfig.getId()); | |||||
| wxMallConfigService.saveOrUpdate(temp); | |||||
| return new ResultData(); | |||||
| } | |||||
| @PostMapping("updateVerifyConpon") | |||||
| @ApiOperation("修改核销开关") | |||||
| public ResultData updateVerifyConpon(@RequestBody WxMallConfig wxMallConfig) { | |||||
| WxMallConfig temp = new WxMallConfig(); | |||||
| temp.setKey("verifyConponSwitch"); | |||||
| temp.setTenantId(getTenantId()); | |||||
| temp.setValue(wxMallConfig.getValue()); | |||||
| temp.setId(wxMallConfig.getId()); | |||||
| wxMallConfigService.saveOrUpdate(temp); | |||||
| return new ResultData(); | |||||
| } | |||||
| // @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 WxMallConfig wxMallConfig,Integer pageNum, Integer pageSize) { | |||||
| // if (null == wxMallConfig) wxMallConfig = new WxMallConfig(); | |||||
| // final PageInfo<WxMallConfig> page = wxMallConfigService.listAsPage(wxMallConfig, pageNum, pageSize); | |||||
| // return new ResultData(page); | |||||
| // } | |||||
| // | |||||
| // @ApiOperation("新增接口") | |||||
| // @PostMapping("add") | |||||
| // public ResultData add(@RequestBody WxMallConfig wxMallConfig) { | |||||
| // //Assert.notNull(wxMallConfig.getName(), "角色名不能为空"); | |||||
| // //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||||
| // wxMallConfigService.saveOrUpdate(wxMallConfig); | |||||
| // return new ResultData(); | |||||
| // } | |||||
| // | |||||
| // @ApiOperation("根据id更新接口") | |||||
| // @PostMapping("update") | |||||
| // public ResultData update(@RequestBody WxMallConfig wxMallConfig) { | |||||
| // wxMallConfigService.saveOrUpdate(wxMallConfig); | |||||
| // return new ResultData(); | |||||
| // } | |||||
| // | |||||
| // @ApiOperation("根据id删除接口") | |||||
| // @GetMapping("/del") | |||||
| // @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||||
| // public ResultData delete(Long id) { | |||||
| // wxMallConfigService.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,"查询成功",wxMallConfigService.getById(id)); | |||||
| // } | |||||
| } | |||||
| @@ -0,0 +1,162 @@ | |||||
| package com.simple.domain.po; | |||||
| import javax.persistence.*; | |||||
| import java.util.*; | |||||
| import java.math.*; | |||||
| import javax.persistence.Transient; | |||||
| import java.util.List; | |||||
| import javax.persistence.Id; | |||||
| import java.io.Serializable; | |||||
| @Table(name = "wx_mall_config") | |||||
| public class WxMallConfig 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="key") | |||||
| private String key; | |||||
| /*0:启用 1:停用**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="0:启用 1:停用",name="value") | |||||
| private Integer value; | |||||
| /*备注**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="备注",name="remark") | |||||
| private String remark; | |||||
| /*创建时间**/ | |||||
| @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) { | |||||
| tenantId = _tenantId; | |||||
| } | |||||
| public String getKey() { | |||||
| return key; | |||||
| } | |||||
| public void setKey(String _key) { | |||||
| key = _key; | |||||
| } | |||||
| 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 | |||||
| { | |||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||||
| ,Key_ASC("`key` ASC"),Key_DESC("`key` DESC") | |||||
| ,Value_ASC("`value` ASC"),Value_DESC("`value` DESC") | |||||
| ,Remark_ASC("`remark` ASC"),Remark_DESC("`remark` DESC") | |||||
| ,CreateTime_ASC("`createTime` ASC"),CreateTime_DESC("`createTime` DESC") | |||||
| ,UpdateTime_ASC("`updateTime` ASC"),UpdateTime_DESC("`updateTime` 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(WxMallConfig.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()); | |||||
| } | |||||
| } | |||||
| public void setSortColumns(String sortColumns) | |||||
| { | |||||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | |||||
| return; | |||||
| } | |||||
| if (sortColumns.contains(",")) { | |||||
| String[] cols = sortColumns.split(","); | |||||
| java.util.List<Field> fList = new java.util.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,17 @@ | |||||
| package com.simple.mapper; | |||||
| import java.util.*; | |||||
| import com.simple.common.CommonMapper; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import com.simple.domain.po.WxMallConfig; | |||||
| public interface WxMallConfigMapper extends CommonMapper<WxMallConfig, Long> { | |||||
| List<WxMallConfig> findList(WxMallConfig wxMallConfig); | |||||
| } | |||||
| @@ -0,0 +1,48 @@ | |||||
| package com.simple.service; | |||||
| import java.util.*; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.simple.domain.po.WxMallConfig; | |||||
| public interface WxMallConfigService { | |||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @param offset | |||||
| * @param limit | |||||
| * @return | |||||
| */ | |||||
| PageInfo<WxMallConfig> listAsPage(WxMallConfig record, Integer pageIndex, Integer pageSize); | |||||
| /** | |||||
| * 根据Id获得实体 | |||||
| * | |||||
| * @param id | |||||
| * @return | |||||
| */ | |||||
| WxMallConfig getById(Long id); | |||||
| /** | |||||
| * 保存或更新实体 | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| void saveOrUpdate(WxMallConfig record); | |||||
| /** | |||||
| * 根据Id删除实体 | |||||
| * | |||||
| * @param id | |||||
| */ | |||||
| void deleteById(Long id); | |||||
| } | |||||
| @@ -0,0 +1,54 @@ | |||||
| package com.simple.service.impl; | |||||
| import java.util.*; | |||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.simple.domain.po.WxMallConfig; | |||||
| import com.simple.mapper.WxMallConfigMapper; | |||||
| import com.simple.service.WxMallConfigService; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import com.simple.common.IdWorker; | |||||
| @Service | |||||
| public class WxMallConfigServiceImpl implements WxMallConfigService { | |||||
| @Autowired | |||||
| WxMallConfigMapper wxMallConfigMapper; | |||||
| @Override | |||||
| public PageInfo<WxMallConfig> listAsPage(WxMallConfig record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMallConfigMapper.findList(record)); | |||||
| } | |||||
| @Override | |||||
| public WxMallConfig getById(Long id) { | |||||
| return wxMallConfigMapper.selectByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public void saveOrUpdate(WxMallConfig record) { | |||||
| if (record.getId() == null) { | |||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||||
| IdWorker idWorker = new IdWorker(0, 0); | |||||
| record.setId(idWorker.nextId()); | |||||
| wxMallConfigMapper.insertSelective(record); | |||||
| } else { | |||||
| wxMallConfigMapper.updateByPrimaryKeySelective(record); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void deleteById(Long id) { | |||||
| wxMallConfigMapper.deleteByPrimaryKey(id); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,74 @@ | |||||
| <?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.simple.mapper.WxMallConfigMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.WxMallConfig"> | |||||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||||
| <result column="key" jdbcType="VARCHAR" property="key" /> | |||||
| <result column="value" jdbcType="INTEGER" property="value" /> | |||||
| <result column="remark" jdbcType="VARCHAR" property="remark" /> | |||||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | |||||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`tenant_id`,`key`,`value`,`remark`,`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` like concat('%', #{tenantId},'%') | |||||
| </if> | |||||
| <if test=" null != key "> | |||||
| and `key` like concat('%', #{key},'%') | |||||
| </if> | |||||
| <if test=" null != value "> | |||||
| and `value` = #{value} | |||||
| </if> | |||||
| <if test=" null != remark "> | |||||
| and `remark` like concat('%', #{remark},'%') | |||||
| </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.simple.domain.po.WxMallConfig" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from wx_mall_config | |||||
| <include refid="dynamicWhereConditions" /> | |||||
| </select> | |||||
| </mapper> | |||||