Commit c9f2c1b7 by 吴迪

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

parent 32894af0
...@@ -12,12 +12,10 @@ import com.wangtian.modules.manage.entity.SysDictEntity; ...@@ -12,12 +12,10 @@ import com.wangtian.modules.manage.entity.SysDictEntity;
import com.wangtian.modules.manage.form.SysDictForm; import com.wangtian.modules.manage.form.SysDictForm;
import com.wangtian.modules.manage.service.SysDictService; import com.wangtian.modules.manage.service.SysDictService;
import com.wangtian.modules.sys.controller.AbstractController; 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;
...@@ -70,13 +68,7 @@ public class SysDictController extends AbstractController { ...@@ -70,13 +68,7 @@ public class SysDictController extends AbstractController {
//转化实体对象 //转化实体对象
SysDictEntity sysDictEntity = new SysDictEntity(); SysDictEntity sysDictEntity = new SysDictEntity();
BeanUtil.copyProperties(sysDict,sysDictEntity); BeanUtil.copyProperties(sysDict,sysDictEntity);
sysDictEntity.setId(idWorkService.getSEQByKey("id_seq")); sysDictService.saveSysDict(sysDictEntity,getUser());
//获取登录用户信息
SysUserEntity loginUser = getUser();
sysDictEntity.setCreateUserId(loginUser.getUserId());
sysDictEntity.setCreateUserName(loginUser.getUsername());
sysDictEntity.setCreateTime(new Date());
sysDictService.save(sysDictEntity);
return R.ok(); return R.ok();
} }
...@@ -91,12 +83,7 @@ public class SysDictController extends AbstractController { ...@@ -91,12 +83,7 @@ public class SysDictController extends AbstractController {
//转化实体对象 //转化实体对象
SysDictEntity sysDictEntity = new SysDictEntity(); SysDictEntity sysDictEntity = new SysDictEntity();
BeanUtil.copyProperties(sysDict,sysDictEntity); BeanUtil.copyProperties(sysDict,sysDictEntity);
//获取登录用户信息 sysDictService.updateSysDictById(sysDictEntity,getUser());
SysUserEntity loginUser = getUser();
sysDictEntity.setUpdateTime(new Date());
sysDictEntity.setUpdateUserName(loginUser.getUsername());
sysDictEntity.setUpdateUserId(loginUser.getUserId());
sysDictService.updateById(sysDictEntity);
return R.ok(); return R.ok();
} }
......
...@@ -12,12 +12,10 @@ import com.wangtian.modules.manage.entity.SysDictItemEntity; ...@@ -12,12 +12,10 @@ import com.wangtian.modules.manage.entity.SysDictItemEntity;
import com.wangtian.modules.manage.form.SysDictItemForm; 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.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;
...@@ -72,13 +70,7 @@ public class SysDictItemController extends AbstractController { ...@@ -72,13 +70,7 @@ public class SysDictItemController extends AbstractController {
//转化实体对象 //转化实体对象
SysDictItemEntity sysDictItemEntity = new SysDictItemEntity(); SysDictItemEntity sysDictItemEntity = new SysDictItemEntity();
BeanUtil.copyProperties(sysDictItemForm,sysDictItemEntity); BeanUtil.copyProperties(sysDictItemForm,sysDictItemEntity);
sysDictItemEntity.setId(idWorkService.getSEQByKey("id_seq")); sysDictItemService.saveDictItem(sysDictItemEntity,getUser());
//获取登录用户信息
SysUserEntity loginUser = getUser();
sysDictItemEntity.setCreateUserId(loginUser.getUserId());
sysDictItemEntity.setCreateUserName(loginUser.getUsername());
sysDictItemEntity.setCreateTime(new Date());
sysDictItemService.save(sysDictItemEntity);
return R.ok(); return R.ok();
} }
...@@ -93,12 +85,7 @@ public class SysDictItemController extends AbstractController { ...@@ -93,12 +85,7 @@ public class SysDictItemController extends AbstractController {
//转化实体对象 //转化实体对象
SysDictItemEntity sysDictItemEntity = new SysDictItemEntity(); SysDictItemEntity sysDictItemEntity = new SysDictItemEntity();
BeanUtil.copyProperties(sysDictItemForm,sysDictItemEntity); BeanUtil.copyProperties(sysDictItemForm,sysDictItemEntity);
//获取登录用户信息 sysDictItemService.updateSysDictItemById(sysDictItemEntity,getUser());
SysUserEntity loginUser = getUser();
sysDictItemEntity.setUpdateTime(new Date());
sysDictItemEntity.setUpdateUserName(loginUser.getUsername());
sysDictItemEntity.setUpdateUserId(loginUser.getUserId());
sysDictItemService.updateById(sysDictItemEntity);
return R.ok(); return R.ok();
} }
......
...@@ -3,6 +3,7 @@ package com.wangtian.modules.manage.service; ...@@ -3,6 +3,7 @@ package com.wangtian.modules.manage.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.wangtian.common.utils.PageUtils; import com.wangtian.common.utils.PageUtils;
import com.wangtian.modules.manage.entity.SysDictItemEntity; import com.wangtian.modules.manage.entity.SysDictItemEntity;
import com.wangtian.modules.sys.entity.SysUserEntity;
import java.util.Map; import java.util.Map;
...@@ -16,5 +17,9 @@ import java.util.Map; ...@@ -16,5 +17,9 @@ import java.util.Map;
public interface SysDictItemService extends IService<SysDictItemEntity> { public interface SysDictItemService extends IService<SysDictItemEntity> {
PageUtils queryPage(Map<String, Object> params); PageUtils queryPage(Map<String, Object> params);
void updateSysDictItemById(SysDictItemEntity sysDictItem, SysUserEntity loginUser);
void saveDictItem(SysDictItemEntity sysDictItem, SysUserEntity loginUser);
} }
...@@ -3,6 +3,8 @@ package com.wangtian.modules.manage.service; ...@@ -3,6 +3,8 @@ package com.wangtian.modules.manage.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.wangtian.common.utils.PageUtils; import com.wangtian.common.utils.PageUtils;
import com.wangtian.modules.manage.entity.SysDictEntity; import com.wangtian.modules.manage.entity.SysDictEntity;
import com.wangtian.modules.sys.entity.SysUserEntity;
import org.springframework.transaction.annotation.Transactional;
import java.util.Map; import java.util.Map;
...@@ -16,5 +18,12 @@ import java.util.Map; ...@@ -16,5 +18,12 @@ import java.util.Map;
public interface SysDictService extends IService<SysDictEntity> { public interface SysDictService extends IService<SysDictEntity> {
PageUtils queryPage(Map<String, Object> params); PageUtils queryPage(Map<String, Object> params);
@Transactional
void saveSysDict(SysDictEntity sysDictEntity, SysUserEntity loginUser);
@Transactional
void updateSysDictById(SysDictEntity sysDictEntity, SysUserEntity loginUser);
} }
...@@ -3,19 +3,26 @@ package com.wangtian.modules.manage.service.impl; ...@@ -3,19 +3,26 @@ package com.wangtian.modules.manage.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sitech.idworkstarter.IdWorkService;
import com.wangtian.common.utils.PageUtils; import com.wangtian.common.utils.PageUtils;
import com.wangtian.common.utils.Query; import com.wangtian.common.utils.Query;
import com.wangtian.modules.manage.dao.SysDictItemDao; import com.wangtian.modules.manage.dao.SysDictItemDao;
import com.wangtian.modules.manage.entity.SysDictItemEntity; import com.wangtian.modules.manage.entity.SysDictItemEntity;
import com.wangtian.modules.manage.service.SysDictItemService; import com.wangtian.modules.manage.service.SysDictItemService;
import com.wangtian.modules.sys.entity.SysUserEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.Map; import java.util.Map;
@Service("sysDictItemService") @Service("sysDictItemService")
public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemDao, SysDictItemEntity> implements SysDictItemService { public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemDao, SysDictItemEntity> implements SysDictItemService {
@Autowired
IdWorkService idWorkService;
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
IPage<SysDictItemEntity> page = this.page( IPage<SysDictItemEntity> page = this.page(
...@@ -28,4 +35,24 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemDao, SysDictI ...@@ -28,4 +35,24 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemDao, SysDictI
return new PageUtils(page); return new PageUtils(page);
} }
@Override
public void updateSysDictItemById(SysDictItemEntity sysDictItem, SysUserEntity loginUser) {
sysDictItem.setId(idWorkService.getSEQByKey("id_seq"));
//获取登录用户信息
sysDictItem.setCreateUserId(loginUser.getUserId());
sysDictItem.setCreateUserName(loginUser.getUsername());
sysDictItem.setCreateTime(new Date());
baseMapper.updateById(sysDictItem);
}
@Override
public void saveDictItem(SysDictItemEntity sysDictItem, SysUserEntity loginUser) {
sysDictItem.setId(idWorkService.getSEQByKey("id_seq"));
//获取登录用户信息
sysDictItem.setCreateUserId(loginUser.getUserId());
sysDictItem.setCreateUserName(loginUser.getUsername());
sysDictItem.setCreateTime(new Date());
baseMapper.insert(sysDictItem);
}
} }
...@@ -3,19 +3,26 @@ package com.wangtian.modules.manage.service.impl; ...@@ -3,19 +3,26 @@ package com.wangtian.modules.manage.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sitech.idworkstarter.IdWorkService;
import com.wangtian.common.utils.PageUtils; import com.wangtian.common.utils.PageUtils;
import com.wangtian.common.utils.Query; import com.wangtian.common.utils.Query;
import com.wangtian.modules.manage.dao.SysDictDao; import com.wangtian.modules.manage.dao.SysDictDao;
import com.wangtian.modules.manage.entity.SysDictEntity; import com.wangtian.modules.manage.entity.SysDictEntity;
import com.wangtian.modules.manage.service.SysDictService; import com.wangtian.modules.manage.service.SysDictService;
import com.wangtian.modules.sys.entity.SysUserEntity;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.Map; import java.util.Map;
@Service("sysDictService") @Service("sysDictService")
public class SysDictServiceImpl extends ServiceImpl<SysDictDao, SysDictEntity> implements SysDictService { public class SysDictServiceImpl extends ServiceImpl<SysDictDao, SysDictEntity> implements SysDictService {
@Autowired
IdWorkService idWorkService;
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
...@@ -29,4 +36,22 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictDao, SysDictEntity> i ...@@ -29,4 +36,22 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictDao, SysDictEntity> i
return new PageUtils(page); return new PageUtils(page);
} }
@Override
public void saveSysDict(SysDictEntity sysDictEntity,SysUserEntity loginUser) {
sysDictEntity.setId(idWorkService.getSEQByKey("id_seq"));
//获取登录用户信息
sysDictEntity.setCreateUserId(loginUser.getUserId());
sysDictEntity.setCreateUserName(loginUser.getUsername());
sysDictEntity.setCreateTime(new Date());
baseMapper.insert(sysDictEntity);
}
@Override
public void updateSysDictById(SysDictEntity sysDictEntity, SysUserEntity loginUser) {
sysDictEntity.setUpdateTime(new Date());
sysDictEntity.setUpdateUserName(loginUser.getUsername());
sysDictEntity.setUpdateUserId(loginUser.getUserId());
baseMapper.updateById(sysDictEntity);
}
} }
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