| @@ -2,52 +2,51 @@ package com.simple.controller; | |||||
| import org.apache.log4j.Logger; | import org.apache.log4j.Logger; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.util.Assert; | |||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.simple.common.Result; | import com.simple.common.Result; | ||||
| import com.simple.common.ResultData; | import com.simple.common.ResultData; | ||||
| import com.simple.domain.po.WxCUserCars; | |||||
| import com.simple.service.WxCUserCarsService; | |||||
| import com.simple.domain.po.WxCUserCar; | |||||
| import com.simple.service.WxCUserCarService; | |||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| @RestController | @RestController | ||||
| @RequestMapping("wxCUserCars") | @RequestMapping("wxCUserCars") | ||||
| public class WxCUserCarsController extends BaseController | |||||
| public class WxCUserCarController extends BaseController | |||||
| { | { | ||||
| @Autowired | @Autowired | ||||
| private WxCUserCarsService wxCUserCarsService; | |||||
| private WxCUserCarService wxCUserCarService; | |||||
| private Logger logger = Logger.getLogger(WxCUserCarsController.class); | |||||
| private Logger logger = Logger.getLogger(WxCUserCarController.class); | |||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @GetMapping("list") | @GetMapping("list") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | ||||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | ||||
| public ResultData list(@ModelAttribute WxCUserCars wxCUserCars,Integer pageNum, Integer pageSize) { | |||||
| if (null == wxCUserCars) wxCUserCars = new WxCUserCars(); | |||||
| final PageInfo<WxCUserCars> page = wxCUserCarsService.listAsPage(wxCUserCars, pageNum, pageSize); | |||||
| public ResultData list(@ModelAttribute WxCUserCar wxCUserCars,Integer pageNum, Integer pageSize) { | |||||
| if (null == wxCUserCars) wxCUserCars = new WxCUserCar(); | |||||
| final PageInfo<WxCUserCar> page = wxCUserCarService.listAsPage(wxCUserCars, pageNum, pageSize); | |||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @ApiOperation("新增接口") | @ApiOperation("新增接口") | ||||
| @PostMapping("add") | @PostMapping("add") | ||||
| public ResultData add(@RequestBody WxCUserCars wxCUserCars) { | |||||
| public ResultData add(@RequestBody WxCUserCar wxCUserCar) { | |||||
| //Assert.notNull(wxCUserCars.getName(), "角色名不能为空"); | //Assert.notNull(wxCUserCars.getName(), "角色名不能为空"); | ||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | ||||
| wxCUserCarsService.saveOrUpdate(wxCUserCars); | |||||
| wxCUserCarService.saveOrUpdate(wxCUserCar); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @ApiOperation("根据id更新接口") | @ApiOperation("根据id更新接口") | ||||
| @PostMapping("update") | @PostMapping("update") | ||||
| public ResultData update(@RequestBody WxCUserCars wxCUserCars) { | |||||
| wxCUserCarsService.saveOrUpdate(wxCUserCars); | |||||
| public ResultData update(@RequestBody WxCUserCar wxCUserCars) { | |||||
| wxCUserCarService.saveOrUpdate(wxCUserCars); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -55,7 +54,7 @@ public class WxCUserCarsController extends BaseController | |||||
| @GetMapping("/del") | @GetMapping("/del") | ||||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | ||||
| public ResultData delete(Long id) { | public ResultData delete(Long id) { | ||||
| wxCUserCarsService.deleteById(id); | |||||
| wxCUserCarService.deleteById(id); | |||||
| return new ResultData(Result.SUCCESS, "删除成功", null); | return new ResultData(Result.SUCCESS, "删除成功", null); | ||||
| } | } | ||||
| @@ -63,7 +62,7 @@ public class WxCUserCarsController extends BaseController | |||||
| @GetMapping("/findById") | @GetMapping("/findById") | ||||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | ||||
| public ResultData findById(Long id) { | public ResultData findById(Long id) { | ||||
| return new ResultData(Result.SUCCESS,"查询成功",wxCUserCarsService.getById(id)); | |||||
| return new ResultData(Result.SUCCESS,"查询成功",wxCUserCarService.getById(id)); | |||||
| } | } | ||||
| @@ -2,52 +2,51 @@ package com.simple.controller; | |||||
| import org.apache.log4j.Logger; | import org.apache.log4j.Logger; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.util.Assert; | |||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.simple.common.Result; | import com.simple.common.Result; | ||||
| import com.simple.common.ResultData; | import com.simple.common.ResultData; | ||||
| import com.simple.domain.po.WxCUserCars; | |||||
| import com.simple.service.WxCUserCarsService; | |||||
| import com.simple.domain.po.WxCUserCar; | |||||
| import com.simple.service.WxCUserCarService; | |||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| @RestController | @RestController | ||||
| @RequestMapping("wxCUserCars") | @RequestMapping("wxCUserCars") | ||||
| public class WxCUserCarsController extends BaseController | |||||
| public class WxCUserCarController extends BaseController | |||||
| { | { | ||||
| @Autowired | @Autowired | ||||
| private WxCUserCarsService wxCUserCarsService; | |||||
| private WxCUserCarService wxCUserCarService; | |||||
| private Logger logger = Logger.getLogger(WxCUserCarsController.class); | |||||
| private Logger logger = Logger.getLogger(WxCUserCarController.class); | |||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @GetMapping("list") | @GetMapping("list") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | ||||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | ||||
| public ResultData list(@ModelAttribute WxCUserCars wxCUserCars,Integer pageNum, Integer pageSize) { | |||||
| if (null == wxCUserCars) wxCUserCars = new WxCUserCars(); | |||||
| final PageInfo<WxCUserCars> page = wxCUserCarsService.listAsPage(wxCUserCars, pageNum, pageSize); | |||||
| public ResultData list(@ModelAttribute WxCUserCar wxCUserCars,Integer pageNum, Integer pageSize) { | |||||
| if (null == wxCUserCars) wxCUserCars = new WxCUserCar(); | |||||
| final PageInfo<WxCUserCar> page = wxCUserCarService.listAsPage(wxCUserCars, pageNum, pageSize); | |||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @ApiOperation("新增接口") | @ApiOperation("新增接口") | ||||
| @PostMapping("add") | @PostMapping("add") | ||||
| public ResultData add(@RequestBody WxCUserCars wxCUserCars) { | |||||
| public ResultData add(@RequestBody WxCUserCar wxCUserCars) { | |||||
| //Assert.notNull(wxCUserCars.getName(), "角色名不能为空"); | //Assert.notNull(wxCUserCars.getName(), "角色名不能为空"); | ||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | ||||
| wxCUserCarsService.saveOrUpdate(wxCUserCars); | |||||
| wxCUserCarService.saveOrUpdate(wxCUserCars); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @ApiOperation("根据id更新接口") | @ApiOperation("根据id更新接口") | ||||
| @PostMapping("update") | @PostMapping("update") | ||||
| public ResultData update(@RequestBody WxCUserCars wxCUserCars) { | |||||
| wxCUserCarsService.saveOrUpdate(wxCUserCars); | |||||
| public ResultData update(@RequestBody WxCUserCar wxCUserCar) { | |||||
| wxCUserCarService.saveOrUpdate(wxCUserCar); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -55,7 +54,7 @@ public class WxCUserCarsController extends BaseController | |||||
| @GetMapping("/del") | @GetMapping("/del") | ||||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | ||||
| public ResultData delete(Long id) { | public ResultData delete(Long id) { | ||||
| wxCUserCarsService.deleteById(id); | |||||
| wxCUserCarService.deleteById(id); | |||||
| return new ResultData(Result.SUCCESS, "删除成功", null); | return new ResultData(Result.SUCCESS, "删除成功", null); | ||||
| } | } | ||||
| @@ -63,7 +62,7 @@ public class WxCUserCarsController extends BaseController | |||||
| @GetMapping("/findById") | @GetMapping("/findById") | ||||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | ||||
| public ResultData findById(Long id) { | public ResultData findById(Long id) { | ||||
| return new ResultData(Result.SUCCESS,"查询成功",wxCUserCarsService.getById(id)); | |||||
| return new ResultData(Result.SUCCESS,"查询成功",wxCUserCarService.getById(id)); | |||||
| } | } | ||||
| @@ -3,13 +3,15 @@ package com.simple.controller; | |||||
| import com.alibaba.fastjson.JSON; | import com.alibaba.fastjson.JSON; | ||||
| import com.alibaba.fastjson.JSONArray; | import com.alibaba.fastjson.JSONArray; | ||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.simple.common.ErrorCode; | import com.simple.common.ErrorCode; | ||||
| import com.simple.common.Result; | import com.simple.common.Result; | ||||
| import com.simple.common.ResultData; | import com.simple.common.ResultData; | ||||
| import com.simple.domain.po.WxCUser; | |||||
| import com.simple.domain.po.WxCUserCar; | |||||
| import com.simple.domain.po.WxCarCmdLogs; | import com.simple.domain.po.WxCarCmdLogs; | ||||
| import com.simple.domain.po.WxPark; | import com.simple.domain.po.WxPark; | ||||
| import com.simple.enums.EnumCarVendor; | import com.simple.enums.EnumCarVendor; | ||||
| import com.simple.service.WxCUserCarService; | |||||
| import com.simple.service.WxCarCmdLogsService; | import com.simple.service.WxCarCmdLogsService; | ||||
| import com.simple.service.WxParkService; | import com.simple.service.WxParkService; | ||||
| import com.simple.utils.ETCPUtil; | import com.simple.utils.ETCPUtil; | ||||
| @@ -38,17 +40,15 @@ public class WxCarController extends BaseController | |||||
| @Autowired | @Autowired | ||||
| WxParkService wxParkService; | WxParkService wxParkService; | ||||
| @Autowired | |||||
| WxCUserCarService wxCUserCarService; | |||||
| private WxPark getCurrentPark() { | private WxPark getCurrentPark() { | ||||
| WxCUser user = getUser(); | |||||
| WxPark wxPark = wxParkService.getByTenantId(user.getTenantId()); | |||||
| // 1, get mall's park | // 1, get mall's park | ||||
| // future use redis to optimize | // future use redis to optimize | ||||
| final PageInfo<WxPark> wxParkList = wxParkService.listAsPage(new WxPark(), 1, 1); | |||||
| if (wxParkList.getSize() <= 0) { | |||||
| return null; | |||||
| } | |||||
| WxPark park = wxParkList.getList().get(0); | |||||
| return park; | |||||
| return wxPark; | |||||
| } | } | ||||
| @ApiOperation(value = "获取车场支持的厂家",notes="") | @ApiOperation(value = "获取车场支持的厂家",notes="") | ||||
| @@ -75,6 +75,7 @@ public class WxCarController extends BaseController | |||||
| if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { | if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { | ||||
| String phone = paramMap.get("phone"); | String phone = paramMap.get("phone"); | ||||
| if (StringUtils.isBlank(phone)) { | if (StringUtils.isBlank(phone)) { | ||||
| logger.error("手机号为空"); | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "phone为空"); | return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "phone为空"); | ||||
| } | } | ||||
| String params = park.getVendorParams(); | String params = park.getVendorParams(); | ||||
| @@ -91,7 +92,6 @@ public class WxCarController extends BaseController | |||||
| // 获取绑定的车牌 | // 获取绑定的车牌 | ||||
| JSONObject dataObj = retObj.getJSONObject("data"); | JSONObject dataObj = retObj.getJSONObject("data"); | ||||
| String etcpToken = dataObj.getString("token"); | String etcpToken = dataObj.getString("token"); | ||||
| // TODO 异步 | |||||
| ret = etcp.carNum(url, merchantNo, merchantKey, version, etcpToken); | ret = etcp.carNum(url, merchantNo, merchantKey, version, etcpToken); | ||||
| /* | /* | ||||
| { | { | ||||
| @@ -112,10 +112,13 @@ public class WxCarController extends BaseController | |||||
| JSONArray arr = dataObj1.getJSONArray("carList"); | JSONArray arr = dataObj1.getJSONArray("carList"); | ||||
| for(int i=0;i<arr.size();i++) { | for(int i=0;i<arr.size();i++) { | ||||
| // TODO save car | // TODO save car | ||||
| // check carNum+cUserId是否存在, 不存在新建 | |||||
| // wxCUserCarService.saveOrUpdate(); | |||||
| } | } | ||||
| // c端必须保存此token | // c端必须保存此token | ||||
| return new ResultData(dataObj1); | return new ResultData(dataObj1); | ||||
| } else { | } else { | ||||
| logger.error("共同登录失败: "+phone); | |||||
| return new ResultData(ErrorCode.ETCP_LOGIN_FAIL.getCode(), "共同登录失败"); | return new ResultData(ErrorCode.ETCP_LOGIN_FAIL.getCode(), "共同登录失败"); | ||||
| } | } | ||||
| } else if (park.getVendorType() == EnumCarVendor.CAR_TJD.getCode()){ | } else if (park.getVendorType() == EnumCarVendor.CAR_TJD.getCode()){ | ||||
| @@ -279,7 +282,7 @@ public class WxCarController extends BaseController | |||||
| // TODO remove carNumber | // TODO remove carNumber | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } else { | } else { | ||||
| return new ResultData(500, "解绑车牌失败"); | |||||
| return new ResultData(ErrorCode.TJD_UNBIND_FAIL, "解绑车牌失败"); | |||||
| } | } | ||||
| } | } | ||||
| return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "解绑车牌失败"); | return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "解绑车牌失败"); | ||||
| @@ -14,7 +14,9 @@ import com.simple.common.Result; | |||||
| import com.simple.common.ResultData; | import com.simple.common.ResultData; | ||||
| import com.simple.domain.po.WxAppinfo; | import com.simple.domain.po.WxAppinfo; | ||||
| import com.simple.domain.po.WxCUser; | import com.simple.domain.po.WxCUser; | ||||
| import com.simple.domain.po.WxCUserCar; | |||||
| import com.simple.service.WxAppinfoService; | import com.simple.service.WxAppinfoService; | ||||
| import com.simple.service.WxCUserCarService; | |||||
| import com.simple.service.WxCUserService; | import com.simple.service.WxCUserService; | ||||
| import com.simple.utils.IPUtil; | import com.simple.utils.IPUtil; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| @@ -31,6 +33,7 @@ import org.springframework.web.context.request.ServletRequestAttributes; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import java.util.List; | |||||
| import java.util.Map; | import java.util.Map; | ||||
| @RestController | @RestController | ||||
| @@ -41,6 +44,9 @@ public class WxUserGrantController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxCUserService wxCUserService; | private WxCUserService wxCUserService; | ||||
| @Autowired | |||||
| private WxCUserCarService wxCUserCarService; | |||||
| /** | /** | ||||
| * 用户登录 | * 用户登录 | ||||
| * @param map | * @param map | ||||
| @@ -227,11 +233,24 @@ public class WxUserGrantController extends BaseController { | |||||
| } | } | ||||
| } | } | ||||
| @ApiOperation("获取用户信息") | |||||
| @GetMapping("/findById") | |||||
| @ApiOperation("获取当前用户信息") | |||||
| @GetMapping("/userinfo") | |||||
| public ResultData getUserInfo() { | public ResultData getUserInfo() { | ||||
| WxCUser user = getUser(); | WxCUser user = getUser(); | ||||
| return new ResultData(Result.SUCCESS,"查询成功",user); | return new ResultData(Result.SUCCESS,"查询成功",user); | ||||
| } | } | ||||
| // | |||||
| @ApiOperation("获取当前用户车牌列表") | |||||
| @GetMapping("/carlist") | |||||
| public ResultData getCarList() { | |||||
| WxCUser user = getUser(); | |||||
| WxCUserCar userCar = new WxCUserCar(); | |||||
| userCar.setTenantId(user.getTenantId()); | |||||
| userCar.setCUserId(user.getId()); | |||||
| List<WxCUserCar> list = wxCUserCarService.getList(userCar); | |||||
| return new ResultData(Result.SUCCESS,"获取查询成功", list); | |||||
| } | |||||
| } | } | ||||
| @@ -8,15 +8,15 @@ import java.util.List; | |||||
| import javax.persistence.Id; | import javax.persistence.Id; | ||||
| import java.io.Serializable; | import java.io.Serializable; | ||||
| @Table(name = "wx_c_user_cars") | |||||
| public class WxCUserCars implements Serializable { | |||||
| @Table(name = "wx_c_user_car") | |||||
| public class WxCUserCar implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | private static final long serialVersionUID = 1L; | ||||
| @Id | @Id | ||||
| protected Long id; | protected Long id; | ||||
| @Transient | @Transient | ||||
| protected List<String> ids; | |||||
| protected List<Long> ids; | |||||
| @Transient | @Transient | ||||
| protected String sortColumns; | protected String sortColumns; | ||||
| @@ -32,10 +32,11 @@ public class WxCUserCars implements Serializable { | |||||
| return sortColumns; | return sortColumns; | ||||
| } | } | ||||
| public List<String> getIds() { | |||||
| public List<Long> getIds() { | |||||
| return ids; | return ids; | ||||
| } | } | ||||
| public void setIds(List<String> ids) { | |||||
| public void setIds(List<Long> ids) { | |||||
| this.ids = ids; | this.ids = ids; | ||||
| } | } | ||||
| @@ -56,6 +57,12 @@ public class WxCUserCars implements Serializable { | |||||
| /*更新时间**/ | /*更新时间**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | ||||
| private Date updateDate; | private Date updateDate; | ||||
| /*停车厂家(2:TJD)**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="停车厂家(2:TJD)",name="vendorType") | |||||
| private Integer vendorType; | |||||
| /*停车厂家参数**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="停车厂家参数",name="vendorParams") | |||||
| private String vendorParams; | |||||
| public String getTenantId() { | public String getTenantId() { | ||||
| return tenantId; | return tenantId; | ||||
| } | } | ||||
| @@ -86,6 +93,18 @@ public class WxCUserCars implements Serializable { | |||||
| public void setUpdateDate(Date _updateDate) { | public void setUpdateDate(Date _updateDate) { | ||||
| updateDate = _updateDate; | updateDate = _updateDate; | ||||
| } | } | ||||
| public Integer getVendorType() { | |||||
| return vendorType; | |||||
| } | |||||
| public void setVendorType(Integer _vendorType) { | |||||
| vendorType = _vendorType; | |||||
| } | |||||
| public String getVendorParams() { | |||||
| return vendorParams; | |||||
| } | |||||
| public void setVendorParams(String _vendorParams) { | |||||
| vendorParams = _vendorParams; | |||||
| } | |||||
| @@ -97,6 +116,8 @@ public class WxCUserCars implements Serializable { | |||||
| ,CarNumber_ASC("`carNumber` ASC"),CarNumber_DESC("`carNumber` DESC") | ,CarNumber_ASC("`carNumber` ASC"),CarNumber_DESC("`carNumber` DESC") | ||||
| ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") | ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") | ||||
| ,UpdateDate_ASC("`updateDate` ASC"),UpdateDate_DESC("`updateDate` DESC") | ,UpdateDate_ASC("`updateDate` ASC"),UpdateDate_DESC("`updateDate` DESC") | ||||
| ,VendorType_ASC("`vendorType` ASC"),VendorType_DESC("`vendorType` DESC") | |||||
| ,VendorParams_ASC("`vendorParams` ASC"),VendorParams_DESC("`vendorParams` DESC") | |||||
| ; | ; | ||||
| private String value; | private String value; | ||||
| Field(String value){ | Field(String value){ | ||||
| @@ -114,7 +135,7 @@ public class WxCUserCars implements Serializable { | |||||
| } | } | ||||
| } | } | ||||
| public void setSortColumns(WxCUserCars.Field... fields) | |||||
| public void setSortColumns(WxCUserCar.Field... fields) | |||||
| { | { | ||||
| if (fields == null || fields.length == 0) { | if (fields == null || fields.length == 0) { | ||||
| return; | return; | ||||
| @@ -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.WxCUserCar; | |||||
| public interface WxCUserCarMapper extends CommonMapper<WxCUserCar, Long> { | |||||
| List<WxCUserCar> findList(WxCUserCar wxCUserCar); | |||||
| } | |||||
| @@ -1,17 +0,0 @@ | |||||
| package com.simple.mapper; | |||||
| import java.util.*; | |||||
| import com.simple.common.CommonMapper; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import com.simple.domain.po.WxCUserCars; | |||||
| public interface WxCUserCarsMapper extends CommonMapper<WxCUserCars, String> { | |||||
| List<WxCUserCars> findList(WxCUserCars wxCUserCars); | |||||
| } | |||||
| @@ -2,19 +2,27 @@ package com.simple.service; | |||||
| import java.util.*; | import java.util.*; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.simple.domain.po.WxCUserCars; | |||||
| import com.simple.domain.po.WxCUserCar; | |||||
| public interface WxCUserCarsService { | |||||
| public interface WxCUserCarService { | |||||
| /** | /** | ||||
| * 根据实体查询分页列表 | * 根据实体查询分页列表 | ||||
| * | * | ||||
| * @param record | * @param record | ||||
| * @param offset | |||||
| * @param limit | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| PageInfo<WxCUserCars> listAsPage(WxCUserCars record, Integer pageIndex, Integer pageSize); | |||||
| PageInfo<WxCUserCar> listAsPage(WxCUserCar record, Integer pageIndex, Integer pageSize); | |||||
| /** | |||||
| * 根据实体查询列表 | |||||
| * | |||||
| * @param record | |||||
| * @return | |||||
| */ | |||||
| List<WxCUserCar> getList(WxCUserCar record); | |||||
| /** | /** | ||||
| * 根据Id获得实体 | * 根据Id获得实体 | ||||
| @@ -22,14 +30,14 @@ public interface WxCUserCarsService { | |||||
| * @param id | * @param id | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| WxCUserCars getById(Long id); | |||||
| WxCUserCar getById(Long id); | |||||
| /** | /** | ||||
| * 保存或更新实体 | * 保存或更新实体 | ||||
| * | * | ||||
| * @param record | * @param record | ||||
| */ | */ | ||||
| void saveOrUpdate(WxCUserCars record); | |||||
| void saveOrUpdate(WxCUserCar record); | |||||
| /** | /** | ||||
| * 根据Id删除实体 | * 根据Id删除实体 | ||||
| @@ -10,8 +10,8 @@ public interface WxParkService { | |||||
| * 根据实体查询分页列表 | * 根据实体查询分页列表 | ||||
| * | * | ||||
| * @param record | * @param record | ||||
| * @param offset | |||||
| * @param limit | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| PageInfo<WxPark> listAsPage(WxPark record, Integer pageIndex, Integer pageSize); | PageInfo<WxPark> listAsPage(WxPark record, Integer pageIndex, Integer pageSize); | ||||
| @@ -23,6 +23,14 @@ public interface WxParkService { | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| WxPark getById(Long id); | WxPark getById(Long id); | ||||
| /** | |||||
| * 根据tenantId获得实体 | |||||
| * | |||||
| * @param tenantId | |||||
| * @return | |||||
| */ | |||||
| WxPark getByTenantId(String tenantId); | |||||
| /** | /** | ||||
| * 保存或更新实体 | * 保存或更新实体 | ||||
| @@ -0,0 +1,59 @@ | |||||
| package com.simple.service.impl; | |||||
| import java.util.*; | |||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.simple.domain.po.WxCUserCar; | |||||
| import com.simple.mapper.WxCUserCarMapper; | |||||
| import com.simple.service.WxCUserCarService; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import com.simple.common.IdWorker; | |||||
| @Service | |||||
| public class WxCUserCarServiceImpl implements WxCUserCarService { | |||||
| @Autowired | |||||
| WxCUserCarMapper wxCUserCarMapper; | |||||
| @Override | |||||
| public PageInfo<WxCUserCar> listAsPage(WxCUserCar record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserCarMapper.findList(record)); | |||||
| } | |||||
| @Override | |||||
| public List<WxCUserCar> getList(WxCUserCar record) { | |||||
| return wxCUserCarMapper.findList(record); | |||||
| } | |||||
| @Override | |||||
| public WxCUserCar getById(Long id) { | |||||
| return wxCUserCarMapper.selectByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public void saveOrUpdate(WxCUserCar record) { | |||||
| if (record.getId() == null) { | |||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | |||||
| wxCUserCarMapper.insertSelective(record); | |||||
| } else { | |||||
| wxCUserCarMapper.updateByPrimaryKeySelective(record); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void deleteById(Long id) { | |||||
| wxCUserCarMapper.deleteByPrimaryKey(id); | |||||
| } | |||||
| } | |||||
| @@ -1,54 +0,0 @@ | |||||
| package com.simple.service.impl; | |||||
| import java.util.*; | |||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.simple.domain.po.WxCUserCars; | |||||
| import com.simple.mapper.WxCUserCarsMapper; | |||||
| import com.simple.service.WxCUserCarsService; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import com.simple.common.IdWorker; | |||||
| @Service | |||||
| public class WxCUserCarsServiceImpl implements WxCUserCarsService { | |||||
| @Autowired | |||||
| WxCUserCarsMapper wxCUserCarsMapper; | |||||
| @Override | |||||
| public PageInfo<WxCUserCars> listAsPage(WxCUserCars record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserCarsMapper.findList(record)); | |||||
| } | |||||
| @Override | |||||
| public WxCUserCars getById(Long id) { | |||||
| return wxCUserCarsMapper.selectByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public void saveOrUpdate(WxCUserCars record) { | |||||
| if (record.getId() == null) { | |||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | |||||
| wxCUserCarsMapper.insertSelective(record); | |||||
| } else { | |||||
| wxCUserCarsMapper.updateByPrimaryKeySelective(record); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void deleteById(Long id) { | |||||
| wxCUserCarsMapper.deleteByPrimaryKey(id); | |||||
| } | |||||
| } | |||||
| @@ -145,7 +145,7 @@ public class WxMsgValidationcodeServiceImpl implements WxMsgValidationcodeServic | |||||
| wxMsgValidationcode.setExpiretime(expiredate); | wxMsgValidationcode.setExpiretime(expiredate); | ||||
| wxMsgValidationcode.setCreatetime(createtime); | wxMsgValidationcode.setCreatetime(createtime); | ||||
| wxMsgValidationcodeMapper.insertSelective(wxMsgValidationcode); | wxMsgValidationcodeMapper.insertSelective(wxMsgValidationcode); | ||||
| return new ResultData(200,"发送成功"); | |||||
| return new ResultData(Result.SUCCESS,"发送成功"); | |||||
| } | } | ||||
| return new ResultData(500,"发送失败"); | return new ResultData(500,"发送失败"); | ||||
| @@ -27,6 +27,13 @@ public class WxParkServiceImpl implements WxParkService { | |||||
| return wxParkMapper.selectByPrimaryKey(id); | return wxParkMapper.selectByPrimaryKey(id); | ||||
| } | } | ||||
| @Override | |||||
| public WxPark getByTenantId(String tenantId) { | |||||
| WxPark wxPark = new WxPark(); | |||||
| wxPark.setTenantId(tenantId); | |||||
| return wxParkMapper.selectOne(wxPark); | |||||
| } | |||||
| @Override | @Override | ||||
| public void saveOrUpdate(WxPark record) { | public void saveOrUpdate(WxPark record) { | ||||
| if (record.getId() == null) { | if (record.getId() == null) { | ||||
| @@ -1,7 +1,7 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | <?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"> | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||||
| <mapper namespace="com.simple.mapper.WxCUserCarsMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.WxCUserCars"> | |||||
| <mapper namespace="com.simple.mapper.WxCUserCarMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.WxCUserCar"> | |||||
| <id column="id" jdbcType="BIGINT" property="id" /> | <id column="id" jdbcType="BIGINT" property="id" /> | ||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | ||||
| <result column="c_user_id" jdbcType="BIGINT" property="cUserId" /> | <result column="c_user_id" jdbcType="BIGINT" property="cUserId" /> | ||||
| @@ -67,14 +67,9 @@ | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | <if test=" null != sortColumns"> order by ${sortColumns} </if> | ||||
| </sql> | </sql> | ||||
| <select id="findList" parameterType="com.simple.domain.po.WxCUserCars" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from wx_c_user_cars | |||||
| <select id="findList" parameterType="com.simple.domain.po.WxCUserCar" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from wx_c_user_car | |||||
| <include refid="dynamicWhereConditions" /> | <include refid="dynamicWhereConditions" /> | ||||
| </select> | </select> | ||||
| </mapper> | </mapper> | ||||
| @@ -102,7 +102,7 @@ | |||||
| o.c_user_id, u.phone, u.nick_name, c.price, c.sale_price, | o.c_user_id, u.phone, u.nick_name, c.price, c.sale_price, | ||||
| o.status, o.coupon_status | o.status, o.coupon_status | ||||
| from wx_order o | from wx_order o | ||||
| left join wx_coupon c on c.id = o.coupon_id | |||||
| left join wx_coupon_order co on co.id = o.coupon_id | |||||
| left join wx_coupon_verify v on v.coupon_id= o.coupon_id | left join wx_coupon_verify v on v.coupon_id= o.coupon_id | ||||
| left join wx_c_user u on u.id = o.c_user_id | left join wx_c_user u on u.id = o.c_user_id | ||||
| <where> | <where> | ||||