Commit 4fff4212 by 吴迪

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

parent 453bb7ab
...@@ -33,7 +33,7 @@ public class InvestmentPlanController { ...@@ -33,7 +33,7 @@ public class InvestmentPlanController {
public R list(@RequestParam Map<String, Object> params){ public R list(@RequestParam Map<String, Object> params){
PageUtils page = investmentPlanService.queryPage(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 { ...@@ -45,7 +45,7 @@ public class InvestmentPlanController {
public R info(@PathVariable("id") Long id){ public R info(@PathVariable("id") Long id){
InvestmentPlanEntity investmentPlan = investmentPlanService.getById(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; ...@@ -2,6 +2,7 @@ package com.wangtian.modules.manage.controller;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.sitech.idworkstarter.IdWorkService; import com.sitech.idworkstarter.IdWorkService;
import com.wangtian.common.annotation.SysLog;
import com.wangtian.common.utils.PageUtils; import com.wangtian.common.utils.PageUtils;
import com.wangtian.common.utils.R; import com.wangtian.common.utils.R;
import com.wangtian.common.validator.ValidatorUtils; import com.wangtian.common.validator.ValidatorUtils;
...@@ -30,7 +31,7 @@ import java.util.Map; ...@@ -30,7 +31,7 @@ import java.util.Map;
*/ */
@RestController @RestController
@RequestMapping("manage/sysdict") @RequestMapping("manage/sysdict")
public class SysDictController extends AbstractController { public class SysDictController extends AbstractController {
@Autowired @Autowired
private SysDictService sysDictService; private SysDictService sysDictService;
@Autowired @Autowired
...@@ -43,7 +44,7 @@ public class SysDictController extends AbstractController { ...@@ -43,7 +44,7 @@ public class SysDictController extends AbstractController {
//@RequiresPermissions("manage:sysdict:list") //@RequiresPermissions("manage:sysdict:list")
public R list(@RequestParam Map<String, Object> params){ public R list(@RequestParam Map<String, Object> params){
PageUtils page = sysDictService.queryPage(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 { ...@@ -54,13 +55,14 @@ public class SysDictController extends AbstractController {
//@RequiresPermissions("manage:sysdict:info") //@RequiresPermissions("manage:sysdict:info")
public R info(@PathVariable("id") String id){ public R info(@PathVariable("id") String id){
SysDictEntity sysDict = sysDictService.getById(id); SysDictEntity sysDict = sysDictService.getById(id);
return R.ok().put("sysDict", sysDict); return R.ok().put("data", sysDict);
} }
/** /**
* 保存 * 保存
*/ */
@RequestMapping("/save") @RequestMapping("/save")
@SysLog("新增字典")
// @RequiresPermissions("manage:sysdict:save") // @RequiresPermissions("manage:sysdict:save")
public R save(@RequestBody SysDictForm sysDict){ public R save(@RequestBody SysDictForm sysDict){
//校验参数 //校验参数
...@@ -81,6 +83,7 @@ public class SysDictController extends AbstractController { ...@@ -81,6 +83,7 @@ public class SysDictController extends AbstractController {
/** /**
* 修改 * 修改
*/ */
@SysLog("修改字典")
@RequestMapping("/update") @RequestMapping("/update")
//@RequiresPermissions("manage:sysdict:update") //@RequiresPermissions("manage:sysdict:update")
public R update(@RequestBody SysDictForm sysDict){ public R update(@RequestBody SysDictForm sysDict){
...@@ -100,6 +103,7 @@ public class SysDictController extends AbstractController { ...@@ -100,6 +103,7 @@ public class SysDictController extends AbstractController {
/** /**
* 删除 * 删除
*/ */
@SysLog("删除字典")
@RequestMapping("/delete") @RequestMapping("/delete")
//@RequiresPermissions("manage:sysdict:delete") //@RequiresPermissions("manage:sysdict:delete")
public R delete(@RequestBody String[] ids){ public R delete(@RequestBody String[] ids){
......
package com.wangtian.modules.manage.controller; 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.PageUtils;
import com.wangtian.common.utils.R; 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.entity.SysDictItemEntity;
import com.wangtian.modules.manage.form.SysDictItemForm;
import com.wangtian.modules.manage.service.SysDictItemService; 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.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date;
import java.util.Map; import java.util.Map;
...@@ -21,9 +31,11 @@ import java.util.Map; ...@@ -21,9 +31,11 @@ import java.util.Map;
*/ */
@RestController @RestController
@RequestMapping("manage/sysdictitem") @RequestMapping("manage/sysdictitem")
public class SysDictItemController { public class SysDictItemController extends AbstractController {
@Autowired @Autowired
private SysDictItemService sysDictItemService; private SysDictItemService sysDictItemService;
@Autowired
private IdWorkService idWorkService;
/** /**
* 列表 * 列表
...@@ -33,7 +45,7 @@ public class SysDictItemController { ...@@ -33,7 +45,7 @@ public class SysDictItemController {
public R list(@RequestParam Map<String, Object> params){ public R list(@RequestParam Map<String, Object> params){
PageUtils page = sysDictItemService.queryPage(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 { ...@@ -45,34 +57,55 @@ public class SysDictItemController {
public R info(@PathVariable("id") String id){ public R info(@PathVariable("id") String id){
SysDictItemEntity sysDictItem = sysDictItemService.getById(id); SysDictItemEntity sysDictItem = sysDictItemService.getById(id);
return R.ok().put("sysDictItem", sysDictItem); return R.ok().put("data", sysDictItem);
} }
/** /**
* 保存 * 保存
*/ */
@RequestMapping("/save") @RequestMapping("/save")
@SysLog("新增字典条目值")
//@RequiresPermissions("manage:sysdictitem:save") //@RequiresPermissions("manage:sysdictitem:save")
public R save(@RequestBody SysDictItemEntity sysDictItem){ public R save(@RequestBody SysDictItemForm sysDictItemForm){
sysDictItemService.save(sysDictItem); //校验参数
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(); return R.ok();
} }
/** /**
* 修改 * 修改
*/ */
@SysLog("修改字典条目值")
@RequestMapping("/update") @RequestMapping("/update")
// @RequiresPermissions("manage:sysdictitem:update") // @RequiresPermissions("manage:sysdictitem:update")
public R update(@RequestBody SysDictItemEntity sysDictItem){ public R update(@RequestBody SysDictItemForm sysDictItemForm){
sysDictItemService.updateById(sysDictItem); 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(); return R.ok();
} }
/** /**
* 删除 * 删除
*/ */
@SysLog("删除字典条目值")
@RequestMapping("/delete") @RequestMapping("/delete")
// @RequiresPermissions("manage:sysdictitem:delete") // @RequiresPermissions("manage:sysdictitem:delete")
public R delete(@RequestBody String[] ids){ public R delete(@RequestBody String[] ids){
......
...@@ -20,7 +20,9 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemDao, SysDictI ...@@ -20,7 +20,9 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemDao, SysDictI
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
IPage<SysDictItemEntity> page = this.page( IPage<SysDictItemEntity> page = this.page(
new Query<SysDictItemEntity>().getPage(params), new Query<SysDictItemEntity>().getPage(params),
new QueryWrapper<SysDictItemEntity>().eq("is_publish",1) new QueryWrapper<SysDictItemEntity>()
.eq("is_publish",1)
); );
return new PageUtils(page); 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