Commit 4fff4212 by 吴迪

【修改】投资计划、字典表相关代码

parent 453bb7ab
......@@ -33,7 +33,7 @@ public class InvestmentPlanController {
public R list(@RequestParam Map<String, Object> params){
PageUtils page = investmentPlanService.queryPage(params);
return R.ok().put("page", page);
return R.ok().put("data", page);
}
......@@ -45,7 +45,7 @@ public class InvestmentPlanController {
public R info(@PathVariable("id") Long id){
InvestmentPlanEntity investmentPlan = investmentPlanService.getById(id);
return R.ok().put("investmentPlan", investmentPlan);
return R.ok().put("data", investmentPlan);
}
/**
......
......@@ -2,6 +2,7 @@ package com.wangtian.modules.manage.controller;
import cn.hutool.core.bean.BeanUtil;
import com.sitech.idworkstarter.IdWorkService;
import com.wangtian.common.annotation.SysLog;
import com.wangtian.common.utils.PageUtils;
import com.wangtian.common.utils.R;
import com.wangtian.common.validator.ValidatorUtils;
......@@ -30,7 +31,7 @@ import java.util.Map;
*/
@RestController
@RequestMapping("manage/sysdict")
public class SysDictController extends AbstractController {
public class SysDictController extends AbstractController {
@Autowired
private SysDictService sysDictService;
@Autowired
......@@ -43,7 +44,7 @@ public class SysDictController extends AbstractController {
//@RequiresPermissions("manage:sysdict:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = sysDictService.queryPage(params);
return R.ok().put("page", page);
return R.ok().put("data", page);
}
......@@ -54,13 +55,14 @@ public class SysDictController extends AbstractController {
//@RequiresPermissions("manage:sysdict:info")
public R info(@PathVariable("id") String id){
SysDictEntity sysDict = sysDictService.getById(id);
return R.ok().put("sysDict", sysDict);
return R.ok().put("data", sysDict);
}
/**
* 保存
*/
@RequestMapping("/save")
@SysLog("新增字典")
// @RequiresPermissions("manage:sysdict:save")
public R save(@RequestBody SysDictForm sysDict){
//校验参数
......@@ -81,6 +83,7 @@ public class SysDictController extends AbstractController {
/**
* 修改
*/
@SysLog("修改字典")
@RequestMapping("/update")
//@RequiresPermissions("manage:sysdict:update")
public R update(@RequestBody SysDictForm sysDict){
......@@ -100,6 +103,7 @@ public class SysDictController extends AbstractController {
/**
* 删除
*/
@SysLog("删除字典")
@RequestMapping("/delete")
//@RequiresPermissions("manage:sysdict:delete")
public R delete(@RequestBody String[] ids){
......
package com.wangtian.modules.manage.controller;
import cn.hutool.core.bean.BeanUtil;
import com.sitech.idworkstarter.IdWorkService;
import com.wangtian.common.annotation.SysLog;
import com.wangtian.common.utils.PageUtils;
import com.wangtian.common.utils.R;
import com.wangtian.common.validator.ValidatorUtils;
import com.wangtian.common.validator.group.AddGroup;
import com.wangtian.common.validator.group.UpdateGroup;
import com.wangtian.modules.manage.entity.SysDictItemEntity;
import com.wangtian.modules.manage.form.SysDictItemForm;
import com.wangtian.modules.manage.service.SysDictItemService;
import com.wangtian.modules.sys.controller.AbstractController;
import com.wangtian.modules.sys.entity.SysUserEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.Date;
import java.util.Map;
......@@ -21,9 +31,11 @@ import java.util.Map;
*/
@RestController
@RequestMapping("manage/sysdictitem")
public class SysDictItemController {
public class SysDictItemController extends AbstractController {
@Autowired
private SysDictItemService sysDictItemService;
@Autowired
private IdWorkService idWorkService;
/**
* 列表
......@@ -33,7 +45,7 @@ public class SysDictItemController {
public R list(@RequestParam Map<String, Object> params){
PageUtils page = sysDictItemService.queryPage(params);
return R.ok().put("page", page);
return R.ok().put("data", page);
}
......@@ -45,34 +57,55 @@ public class SysDictItemController {
public R info(@PathVariable("id") String id){
SysDictItemEntity sysDictItem = sysDictItemService.getById(id);
return R.ok().put("sysDictItem", sysDictItem);
return R.ok().put("data", sysDictItem);
}
/**
* 保存
*/
@RequestMapping("/save")
@SysLog("新增字典条目值")
//@RequiresPermissions("manage:sysdictitem:save")
public R save(@RequestBody SysDictItemEntity sysDictItem){
sysDictItemService.save(sysDictItem);
public R save(@RequestBody SysDictItemForm sysDictItemForm){
//校验参数
ValidatorUtils.validateEntity(sysDictItemForm, AddGroup.class);
//转化实体对象
SysDictItemEntity sysDictItemEntity = new SysDictItemEntity();
BeanUtil.copyProperties(sysDictItemForm,sysDictItemEntity);
sysDictItemEntity.setId(idWorkService.getSEQByKey("id_seq"));
//获取登录用户信息
SysUserEntity loginUser = getUser();
sysDictItemEntity.setCreateUserId(loginUser.getUserId());
sysDictItemEntity.setCreateUserName(loginUser.getUsername());
sysDictItemEntity.setCreateTime(new Date());
sysDictItemService.save(sysDictItemEntity);
return R.ok();
}
/**
* 修改
*/
@SysLog("修改字典条目值")
@RequestMapping("/update")
// @RequiresPermissions("manage:sysdictitem:update")
public R update(@RequestBody SysDictItemEntity sysDictItem){
sysDictItemService.updateById(sysDictItem);
public R update(@RequestBody SysDictItemForm sysDictItemForm){
ValidatorUtils.validateEntity(sysDictItemForm, UpdateGroup.class);
//转化实体对象
SysDictItemEntity sysDictItemEntity = new SysDictItemEntity();
BeanUtil.copyProperties(sysDictItemForm,sysDictItemEntity);
//获取登录用户信息
SysUserEntity loginUser = getUser();
sysDictItemEntity.setUpdateTime(new Date());
sysDictItemEntity.setUpdateUserName(loginUser.getUsername());
sysDictItemEntity.setUpdateUserId(loginUser.getUserId());
sysDictItemService.updateById(sysDictItemEntity);
return R.ok();
}
/**
* 删除
*/
@SysLog("删除字典条目值")
@RequestMapping("/delete")
// @RequiresPermissions("manage:sysdictitem:delete")
public R delete(@RequestBody String[] ids){
......
......@@ -20,7 +20,9 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemDao, SysDictI
public PageUtils queryPage(Map<String, Object> params) {
IPage<SysDictItemEntity> page = this.page(
new Query<SysDictItemEntity>().getPage(params),
new QueryWrapper<SysDictItemEntity>().eq("is_publish",1)
new QueryWrapper<SysDictItemEntity>()
.eq("is_publish",1)
);
return new PageUtils(page);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment