| | |
| | | package com.ruoyi.admin.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.admin.entity.AppVersion; |
| | | import com.ruoyi.admin.entity.Region; |
| | | import com.ruoyi.admin.entity.SysUser; |
| | | import com.ruoyi.admin.mapper.AppMapper; |
| | | import com.ruoyi.admin.service.RegionService; |
| | | import com.ruoyi.admin.service.SysUserService; |
| | | import com.ruoyi.admin.service.UserService; |
| | | import com.ruoyi.admin.vo.PageDto; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.apache.commons.collections4.Get; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/region") |
| | | @Api(value = "后台-首页", tags = {"后台-首页"}) |
| | | @Api(value = "后台-版本管理", tags = {"后台-版本管理"}) |
| | | public class RegionController { |
| | | |
| | | @Resource |
| | | private RegionService regionService; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private AppMapper appMapper; |
| | | @Resource |
| | | private SysUserService sysUserService; |
| | | |
| | | @PostMapping("/version/list") |
| | | @ApiOperation(value = "列表", tags = {"后台-版本管理"}) |
| | | public R<Page<AppVersion>> versionList(@RequestBody PageDto pageDto) { |
| | | Page<AppVersion> appVersionPage = appMapper.selectPage(Page.of(pageDto.getPageNum(), pageDto.getPageSize()), new QueryWrapper<AppVersion>().orderByDesc("createTime")); |
| | | for (AppVersion record : appVersionPage.getRecords()) { |
| | | SysUser byId = sysUserService.getById(record.getCreateBy()); |
| | | record.setCreateBy(byId.getNickName()); |
| | | } |
| | | return R.ok(appVersionPage); |
| | | |
| | | } |
| | | @Resource |
| | | private RedisService redisService; |
| | | |
| | | @PostMapping("/version/add") |
| | | @ApiOperation(value = "添加", tags = {"后台-版本管理"}) |
| | | public R versionAdd(@RequestBody AppVersion appVersion) { |
| | | com.ruoyi.system.api.domain.SysUser sysUser = tokenService.getLoginUser().getSysUser(); |
| | | appVersion.setCreateBy(String.valueOf(sysUser.getUserId())); |
| | | appMapper.insert(appVersion); |
| | | // redisService.setCacheObject("version",appVersion); |
| | | return R.ok(); |
| | | } |
| | | @PostMapping("/version/delete/{id}") |
| | | @ApiOperation(value = "删除", tags = {"后台-版本管理"}) |
| | | public R versionDelete(@PathVariable Integer id) { |
| | | appMapper.deleteById(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 收货地址省市二级联动 |
| | |
| | | return R.ok(regionService.addressTree1(cityCodeList)); |
| | | } |
| | | |
| | | @GetMapping("/manageaddressTree1") |
| | | @ApiOperation(value = "选择城市:省市二级联动", tags = {"后台-首页"}) |
| | | public R<List<Region>> manageaddressTree1() { |
| | | |
| | | List<String> cityCodeList = new ArrayList<>(); |
| | | |
| | | return R.ok(regionService.addressTree1(cityCodeList)); |
| | | } |
| | | |
| | | } |