| @@ -19,7 +19,7 @@ import com.simple.service.MallPermissionService; | |||||
| */ | */ | ||||
| @RestController | @RestController | ||||
| @RequestMapping("permission") | @RequestMapping("permission") | ||||
| public class SysPermissionController { | |||||
| public class MallPermissionController { | |||||
| @Autowired | @Autowired | ||||
| MallPermissionService mallPermissionService; | MallPermissionService mallPermissionService; | ||||
| @@ -1,78 +1,78 @@ | |||||
| package com.simple.controller; | |||||
| import com.simple.domain.po.MallRole; | |||||
| import com.simple.service.MallRoleService; | |||||
| import com.simple.service.MallRolePermissionService; | |||||
| import io.swagger.annotations.Api; | |||||
| import org.apache.log4j.Logger; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.util.Assert; | |||||
| import org.springframework.web.bind.annotation.GetMapping; | |||||
| import org.springframework.web.bind.annotation.PostMapping; | |||||
| import org.springframework.web.bind.annotation.RequestMapping; | |||||
| import org.springframework.web.bind.annotation.RestController; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.simple.common.Result; | |||||
| import com.simple.common.ResultData; | |||||
| @RestController | |||||
| @RequestMapping("role") | |||||
| @Api(description="角色相关接口") | |||||
| public class RoleController { | |||||
| @Autowired | |||||
| private MallRoleService sysRoleService; | |||||
| @Autowired | |||||
| private MallRolePermissionService SysRolePermissionService; | |||||
| private Logger logger = Logger.getLogger(RoleController.class); | |||||
| @GetMapping("list") | |||||
| public ResultData list(MallRole sysRole, Integer pageNum, Integer pageSize) { | |||||
| final PageInfo<MallRole> page = sysRoleService.listAsPage(sysRole, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @PostMapping("add") | |||||
| public ResultData add(MallRole sysRole) { | |||||
| Assert.notNull(sysRole.getName(), "角色名不能为空"); | |||||
| Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||||
| sysRoleService.saveOrUpdate(sysRole); | |||||
| return new ResultData(); | |||||
| } | |||||
| @PostMapping("update") | |||||
| public ResultData update(MallRole sysRole) { | |||||
| if (sysRole.getName() != null) { | |||||
| System.out.println(checkUnique(sysRole.getName(), sysRole.getId())); | |||||
| Assert.isTrue(!checkUnique(sysRole.getName(), sysRole.getId()), "角色名已存在"); | |||||
| } | |||||
| sysRoleService.saveOrUpdate(sysRole); | |||||
| // Assert.notNull(sysRole.getName(), "角色名不能为空"); | |||||
| return new ResultData(); | |||||
| } | |||||
| @GetMapping("/del") | |||||
| public ResultData delete(Long id) { | |||||
| sysRoleService.deleteById(id); | |||||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||||
| } | |||||
| @GetMapping("setPermission") | |||||
| public ResultData setPermission(Long roleId, String perId) { | |||||
| Assert.notNull(perId,"请选择权限"); | |||||
| /*String[] perIds = perId.split(","); | |||||
| SysRolePermissionService.savePermissions(roleId, perIds);*/ | |||||
| //TODO | |||||
| return new ResultData(Result.SUCCESS, "设置角色权限成功", null); | |||||
| } | |||||
| private boolean checkUnique(String name, Long id) { | |||||
| return sysRoleService.countByName(name, id) > 0 ? true : false; | |||||
| } | |||||
| } | |||||
| package com.simple.controller; | |||||
| import com.simple.domain.po.MallRole; | |||||
| import com.simple.service.MallRoleService; | |||||
| import com.simple.service.MallRolePermissionService; | |||||
| import io.swagger.annotations.Api; | |||||
| import org.apache.log4j.Logger; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.util.Assert; | |||||
| import org.springframework.web.bind.annotation.GetMapping; | |||||
| import org.springframework.web.bind.annotation.PostMapping; | |||||
| import org.springframework.web.bind.annotation.RequestMapping; | |||||
| import org.springframework.web.bind.annotation.RestController; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.simple.common.Result; | |||||
| import com.simple.common.ResultData; | |||||
| @RestController | |||||
| @RequestMapping("role") | |||||
| @Api(description="角色相关接口") | |||||
| public class MallRoleController { | |||||
| @Autowired | |||||
| private MallRoleService sysRoleService; | |||||
| @Autowired | |||||
| private MallRolePermissionService SysRolePermissionService; | |||||
| private Logger logger = Logger.getLogger(MallRoleController.class); | |||||
| @GetMapping("list") | |||||
| public ResultData list(MallRole sysRole, Integer pageNum, Integer pageSize) { | |||||
| final PageInfo<MallRole> page = sysRoleService.listAsPage(sysRole, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @PostMapping("add") | |||||
| public ResultData add(MallRole sysRole) { | |||||
| Assert.notNull(sysRole.getName(), "角色名不能为空"); | |||||
| Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||||
| sysRoleService.saveOrUpdate(sysRole); | |||||
| return new ResultData(); | |||||
| } | |||||
| @PostMapping("update") | |||||
| public ResultData update(MallRole sysRole) { | |||||
| if (sysRole.getName() != null) { | |||||
| System.out.println(checkUnique(sysRole.getName(), sysRole.getId())); | |||||
| Assert.isTrue(!checkUnique(sysRole.getName(), sysRole.getId()), "角色名已存在"); | |||||
| } | |||||
| sysRoleService.saveOrUpdate(sysRole); | |||||
| // Assert.notNull(sysRole.getName(), "角色名不能为空"); | |||||
| return new ResultData(); | |||||
| } | |||||
| @GetMapping("/del") | |||||
| public ResultData delete(Long id) { | |||||
| sysRoleService.deleteById(id); | |||||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||||
| } | |||||
| @GetMapping("setPermission") | |||||
| public ResultData setPermission(Long roleId, String perId) { | |||||
| Assert.notNull(perId,"请选择权限"); | |||||
| /*String[] perIds = perId.split(","); | |||||
| SysRolePermissionService.savePermissions(roleId, perIds);*/ | |||||
| //TODO | |||||
| return new ResultData(Result.SUCCESS, "设置角色权限成功", null); | |||||
| } | |||||
| private boolean checkUnique(String name, Long id) { | |||||
| return sysRoleService.countByName(name, id) > 0 ? true : false; | |||||
| } | |||||
| } | |||||
| @@ -32,7 +32,7 @@ import io.swagger.annotations.ApiOperation; | |||||
| @Api(value = "API - UserInfoController", description = "用户接口") | @Api(value = "API - UserInfoController", description = "用户接口") | ||||
| @RestController | @RestController | ||||
| @RequestMapping("user") | @RequestMapping("user") | ||||
| public class UserInfoController { | |||||
| public class MallUserInfoController { | |||||
| @Autowired | @Autowired | ||||
| MallUserInfoService userInfoService; | MallUserInfoService userInfoService; | ||||
| @@ -68,9 +68,18 @@ public class WxShop implements Serializable { | |||||
| /*店铺相对位置y**/ | /*店铺相对位置y**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="店铺相对位置y",name="y") | @io.swagger.annotations.ApiModelProperty(value="店铺相对位置y",name="y") | ||||
| private BigDecimal y; | private BigDecimal y; | ||||
| /*百度poi**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="百度poi",name="baiduPoi") | |||||
| /*地址**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="地址",name="addr") | |||||
| private String addr; | |||||
| /*百度poi(省市区县street等)**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="百度poi(省市区县street等)",name="baiduPoi") | |||||
| private String baiduPoi; | private String baiduPoi; | ||||
| /*经度- baidu poi**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="经度- baidu poi",name="longitude") | |||||
| private BigDecimal longitude; | |||||
| /*维度-baidu poi**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="维度-baidu poi",name="latitude") | |||||
| private BigDecimal latitude; | |||||
| /*创建时间**/ | /*创建时间**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | ||||
| private Date createDate; | private Date createDate; | ||||
| @@ -131,12 +140,30 @@ public class WxShop implements Serializable { | |||||
| public void setY(BigDecimal _y) { | public void setY(BigDecimal _y) { | ||||
| y = _y; | y = _y; | ||||
| } | } | ||||
| public String getAddr() { | |||||
| return addr; | |||||
| } | |||||
| public void setAddr(String _addr) { | |||||
| addr = _addr; | |||||
| } | |||||
| public String getBaiduPoi() { | public String getBaiduPoi() { | ||||
| return baiduPoi; | return baiduPoi; | ||||
| } | } | ||||
| public void setBaiduPoi(String _baiduPoi) { | public void setBaiduPoi(String _baiduPoi) { | ||||
| baiduPoi = _baiduPoi; | baiduPoi = _baiduPoi; | ||||
| } | } | ||||
| public BigDecimal getLongitude() { | |||||
| return longitude; | |||||
| } | |||||
| public void setLongitude(BigDecimal _longitude) { | |||||
| longitude = _longitude; | |||||
| } | |||||
| public BigDecimal getLatitude() { | |||||
| return latitude; | |||||
| } | |||||
| public void setLatitude(BigDecimal _latitude) { | |||||
| latitude = _latitude; | |||||
| } | |||||
| public Date getCreateDate() { | public Date getCreateDate() { | ||||
| return createDate; | return createDate; | ||||
| } | } | ||||
| @@ -164,7 +191,10 @@ public class WxShop implements Serializable { | |||||
| ,Status_ASC("`status` ASC"),Status_DESC("`status` DESC") | ,Status_ASC("`status` ASC"),Status_DESC("`status` DESC") | ||||
| ,X_ASC("`x` ASC"),X_DESC("`x` DESC") | ,X_ASC("`x` ASC"),X_DESC("`x` DESC") | ||||
| ,Y_ASC("`y` ASC"),Y_DESC("`y` DESC") | ,Y_ASC("`y` ASC"),Y_DESC("`y` DESC") | ||||
| ,Addr_ASC("`addr` ASC"),Addr_DESC("`addr` DESC") | |||||
| ,BaiduPoi_ASC("`baiduPoi` ASC"),BaiduPoi_DESC("`baiduPoi` DESC") | ,BaiduPoi_ASC("`baiduPoi` ASC"),BaiduPoi_DESC("`baiduPoi` DESC") | ||||
| ,Longitude_ASC("`longitude` ASC"),Longitude_DESC("`longitude` DESC") | |||||
| ,Latitude_ASC("`latitude` ASC"),Latitude_DESC("`latitude` 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") | ||||
| ; | ; | ||||
| @@ -32,7 +32,7 @@ public class MallPermissionServiceImpl implements MallPermissionService { | |||||
| public void saveOrUpdate(MallPermission record) { | public void saveOrUpdate(MallPermission record) { | ||||
| if (record.getId() == null) { | if (record.getId() == null) { | ||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | ||||
| record.setId(new IdWorker(0, 0).nextId()); | |||||
| mallPermissionMapper.insertSelective(record); | mallPermissionMapper.insertSelective(record); | ||||
| } else { | } else { | ||||
| mallPermissionMapper.updateByPrimaryKeySelective(record); | mallPermissionMapper.updateByPrimaryKeySelective(record); | ||||
| @@ -12,13 +12,16 @@ | |||||
| <result column="status" jdbcType="INTEGER" property="status" /> | <result column="status" jdbcType="INTEGER" property="status" /> | ||||
| <result column="x" jdbcType="DECIMAL" property="x" /> | <result column="x" jdbcType="DECIMAL" property="x" /> | ||||
| <result column="y" jdbcType="DECIMAL" property="y" /> | <result column="y" jdbcType="DECIMAL" property="y" /> | ||||
| <result column="addr" jdbcType="VARCHAR" property="addr" /> | |||||
| <result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi" /> | <result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi" /> | ||||
| <result column="longitude" jdbcType="DECIMAL" property="longitude" /> | |||||
| <result column="latitude" jdbcType="DECIMAL" property="latitude" /> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | ||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | ||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`shop_number`,`build_area`,`operation_area`,`building`,`floor`,`status`,`x`,`y`,`baidu_poi`,`create_date`,`update_date` | |||||
| `id`,`tenant_id`,`shop_number`,`build_area`,`operation_area`,`building`,`floor`,`status`,`x`,`y`,`addr`,`baidu_poi`,`longitude`,`latitude`,`create_date`,`update_date` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -74,11 +77,26 @@ | |||||
| </if> | </if> | ||||
| <if test=" null != addr "> | |||||
| and `addr` like concat('%', #{addr},'%') | |||||
| </if> | |||||
| <if test=" null != baiduPoi "> | <if test=" null != baiduPoi "> | ||||
| and `baidu_poi` like concat('%', #{baiduPoi},'%') | and `baidu_poi` like concat('%', #{baiduPoi},'%') | ||||
| </if> | </if> | ||||
| <if test=" null != longitude "> | |||||
| and `longitude` = #{longitude} | |||||
| </if> | |||||
| <if test=" null != latitude "> | |||||
| and `latitude` = #{latitude} | |||||
| </if> | |||||
| <if test=" null != createDate "> | <if test=" null != createDate "> | ||||
| and `create_date` = #{createDate} | and `create_date` = #{createDate} | ||||