给部分表增加启用状态和排序字段,完善对应接口
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package com.jsh.erp.service.account;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.constants.ExceptionConstants;
|
||||
import com.jsh.erp.datasource.entities.*;
|
||||
@@ -76,7 +75,7 @@ public class AccountService {
|
||||
|
||||
public List<Account> getAccount() throws Exception{
|
||||
AccountExample example = new AccountExample();
|
||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
example.createCriteria().andEnabledEqualTo(true).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
List<Account> list=null;
|
||||
try{
|
||||
list=accountMapper.selectByExample(example);
|
||||
@@ -139,6 +138,7 @@ public class AccountService {
|
||||
account.setInitialAmount(BigDecimal.ZERO);
|
||||
}
|
||||
account.setIsDefault(false);
|
||||
account.setEnabled(true);
|
||||
int result=0;
|
||||
try{
|
||||
result = accountMapper.insertSelective(account);
|
||||
@@ -250,7 +250,7 @@ public class AccountService {
|
||||
|
||||
public List<Account> findBySelect()throws Exception {
|
||||
AccountExample example = new AccountExample();
|
||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
example.createCriteria().andEnabledEqualTo(true).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
example.setOrderByClause("id desc");
|
||||
List<Account> list=null;
|
||||
try{
|
||||
@@ -573,4 +573,23 @@ public class AccountService {
|
||||
}
|
||||
return priceFmt;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchSetStatus(Boolean status, String ids)throws Exception {
|
||||
logService.insertLog("账户",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ENABLED).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
List<Long> accountIds = StringUtil.strToLongList(ids);
|
||||
Account account = new Account();
|
||||
account.setEnabled(status);
|
||||
AccountExample example = new AccountExample();
|
||||
example.createCriteria().andIdIn(accountIds);
|
||||
int result=0;
|
||||
try{
|
||||
result = accountMapper.updateByExampleSelective(account, example);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ import com.jsh.erp.service.userBusiness.UserBusinessService;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
@@ -89,7 +88,7 @@ public class DepotService {
|
||||
|
||||
public List<Depot> getAllList()throws Exception {
|
||||
DepotExample example = new DepotExample();
|
||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
example.createCriteria().andEnabledEqualTo(true).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
example.setOrderByClause("sort");
|
||||
List<Depot> list=null;
|
||||
try{
|
||||
@@ -127,6 +126,7 @@ public class DepotService {
|
||||
try{
|
||||
depot.setType(0);
|
||||
depot.setIsDefault(false);
|
||||
depot.setEnabled(true);
|
||||
result=depotMapper.insertSelective(depot);
|
||||
//新增仓库时给当前用户自动授权
|
||||
Long userId = userService.getUserId(request);
|
||||
@@ -230,7 +230,8 @@ public class DepotService {
|
||||
|
||||
public List<Depot> findUserDepot()throws Exception{
|
||||
DepotExample example = new DepotExample();
|
||||
example.createCriteria().andTypeEqualTo(0).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
example.createCriteria().andTypeEqualTo(0).andEnabledEqualTo(true)
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
example.setOrderByClause("sort");
|
||||
List<Depot> list=null;
|
||||
try{
|
||||
@@ -340,4 +341,23 @@ public class DepotService {
|
||||
}
|
||||
return depotStr;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchSetStatus(Boolean status, String ids)throws Exception {
|
||||
logService.insertLog("仓库",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ENABLED).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
List<Long> depotIds = StringUtil.strToLongList(ids);
|
||||
Depot depot = new Depot();
|
||||
depot.setEnabled(status);
|
||||
DepotExample example = new DepotExample();
|
||||
example.createCriteria().andIdIn(depotIds);
|
||||
int result=0;
|
||||
try{
|
||||
result = depotMapper.updateByExampleSelective(depot, example);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.jsh.erp.service.inOutItem;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.constants.ExceptionConstants;
|
||||
import com.jsh.erp.datasource.entities.*;
|
||||
import com.jsh.erp.datasource.entities.AccountItem;
|
||||
import com.jsh.erp.datasource.entities.InOutItem;
|
||||
import com.jsh.erp.datasource.entities.InOutItemExample;
|
||||
import com.jsh.erp.datasource.entities.User;
|
||||
import com.jsh.erp.datasource.mappers.AccountItemMapperEx;
|
||||
import com.jsh.erp.datasource.mappers.InOutItemMapper;
|
||||
import com.jsh.erp.datasource.mappers.InOutItemMapperEx;
|
||||
@@ -102,6 +104,7 @@ public class InOutItemService {
|
||||
InOutItem inOutItem = JSONObject.parseObject(obj.toJSONString(), InOutItem.class);
|
||||
int result=0;
|
||||
try{
|
||||
inOutItem.setEnabled(true);
|
||||
result=inOutItemMapper.insertSelective(inOutItem);
|
||||
logService.insertLog("收支项目",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(inOutItem.getName()).toString(), request);
|
||||
@@ -186,9 +189,11 @@ public class InOutItemService {
|
||||
public List<InOutItem> findBySelect(String type)throws Exception {
|
||||
InOutItemExample example = new InOutItemExample();
|
||||
if (type.equals("in")) {
|
||||
example.createCriteria().andTypeEqualTo("收入").andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
example.createCriteria().andTypeEqualTo("收入").andEnabledEqualTo(true)
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
} else if (type.equals("out")) {
|
||||
example.createCriteria().andTypeEqualTo("支出").andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
example.createCriteria().andTypeEqualTo("支出").andEnabledEqualTo(true)
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
}
|
||||
example.setOrderByClause("id desc");
|
||||
List<InOutItem> list = null;
|
||||
@@ -199,4 +204,23 @@ public class InOutItemService {
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchSetStatus(Boolean status, String ids)throws Exception {
|
||||
logService.insertLog("收支项目",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ENABLED).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
List<Long> inOutItemIds = StringUtil.strToLongList(ids);
|
||||
InOutItem inOutItem = new InOutItem();
|
||||
inOutItem.setEnabled(status);
|
||||
InOutItemExample example = new InOutItemExample();
|
||||
example.createCriteria().andIdIn(inOutItemIds);
|
||||
int result=0;
|
||||
try{
|
||||
result = inOutItemMapper.updateByExampleSelective(inOutItem, example);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.jsh.erp.service.person;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.constants.ExceptionConstants;
|
||||
import com.jsh.erp.datasource.entities.*;
|
||||
import com.jsh.erp.datasource.entities.AccountHead;
|
||||
import com.jsh.erp.datasource.entities.DepotHead;
|
||||
import com.jsh.erp.datasource.entities.Person;
|
||||
import com.jsh.erp.datasource.entities.PersonExample;
|
||||
import com.jsh.erp.datasource.mappers.AccountHeadMapperEx;
|
||||
import com.jsh.erp.datasource.mappers.DepotHeadMapperEx;
|
||||
import com.jsh.erp.datasource.mappers.PersonMapper;
|
||||
@@ -23,7 +25,10 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class PersonService {
|
||||
@@ -68,7 +73,7 @@ public class PersonService {
|
||||
|
||||
public List<Person> getPerson()throws Exception {
|
||||
PersonExample example = new PersonExample();
|
||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
example.createCriteria().andEnabledEqualTo(true).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
List<Person> list=null;
|
||||
try{
|
||||
list=personMapper.selectByExample(example);
|
||||
@@ -103,6 +108,7 @@ public class PersonService {
|
||||
Person person = JSONObject.parseObject(obj.toJSONString(), Person.class);
|
||||
int result=0;
|
||||
try{
|
||||
person.setEnabled(true);
|
||||
result=personMapper.insertSelective(person);
|
||||
logService.insertLog("经手人",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(person.getName()).toString(), request);
|
||||
@@ -216,7 +222,8 @@ public class PersonService {
|
||||
|
||||
public List<Person> getPersonByType(String type)throws Exception {
|
||||
PersonExample example = new PersonExample();
|
||||
example.createCriteria().andTypeEqualTo(type).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
example.createCriteria().andTypeEqualTo(type).andEnabledEqualTo(true)
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
example.setOrderByClause("id asc");
|
||||
List<Person> list =null;
|
||||
try{
|
||||
@@ -226,4 +233,23 @@ public class PersonService {
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchSetStatus(Boolean status, String ids)throws Exception {
|
||||
logService.insertLog("经手人",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ENABLED).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
List<Long> personIds = StringUtil.strToLongList(ids);
|
||||
Person person = new Person();
|
||||
person.setEnabled(status);
|
||||
PersonExample example = new PersonExample();
|
||||
example.createCriteria().andIdIn(personIds);
|
||||
int result=0;
|
||||
try{
|
||||
result = personMapper.updateByExampleSelective(person, example);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,11 @@ package com.jsh.erp.service.role;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.constants.ExceptionConstants;
|
||||
import com.jsh.erp.datasource.entities.Role;
|
||||
import com.jsh.erp.datasource.entities.RoleExample;
|
||||
import com.jsh.erp.datasource.entities.User;
|
||||
import com.jsh.erp.datasource.mappers.RoleMapper;
|
||||
import com.jsh.erp.datasource.mappers.RoleMapperEx;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.exception.JshException;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
@@ -64,7 +62,7 @@ public class RoleService {
|
||||
|
||||
public List<Role> allList()throws Exception {
|
||||
RoleExample example = new RoleExample();
|
||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
example.createCriteria().andEnabledEqualTo(true).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
List<Role> list=null;
|
||||
try{
|
||||
list=roleMapper.selectByExample(example);
|
||||
@@ -99,6 +97,7 @@ public class RoleService {
|
||||
Role role = JSONObject.parseObject(obj.toJSONString(), Role.class);
|
||||
int result=0;
|
||||
try{
|
||||
role.setEnabled(true);
|
||||
result=roleMapper.insertSelective(role);
|
||||
logService.insertLog("角色",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(role.getName()).toString(), request);
|
||||
@@ -147,7 +146,7 @@ public class RoleService {
|
||||
public List<Role> findUserRole()throws Exception{
|
||||
RoleExample example = new RoleExample();
|
||||
example.setOrderByClause("Id");
|
||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
example.createCriteria().andEnabledEqualTo(true).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
List<Role> list=null;
|
||||
try{
|
||||
list=roleMapper.selectByExample(example);
|
||||
@@ -187,4 +186,23 @@ public class RoleService {
|
||||
public Role getRoleWithoutTenant(Long roleId) {
|
||||
return roleMapperEx.getRoleWithoutTenant(roleId);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchSetStatus(Boolean status, String ids)throws Exception {
|
||||
logService.insertLog("角色",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ENABLED).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
List<Long> roleIds = StringUtil.strToLongList(ids);
|
||||
Role role = new Role();
|
||||
role.setEnabled(status);
|
||||
RoleExample example = new RoleExample();
|
||||
example.createCriteria().andIdIn(roleIds);
|
||||
int result=0;
|
||||
try{
|
||||
result = roleMapper.updateByExampleSelective(role, example);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,7 +362,7 @@ public class SupplierService {
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchSetStatus(Boolean status, String ids)throws Exception {
|
||||
logService.insertLog("商家",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(ids).toString(),
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ENABLED).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
List<Long> supplierIds = StringUtil.strToLongList(ids);
|
||||
Supplier supplier = new Supplier();
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.jsh.erp.service.unit;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.constants.ExceptionConstants;
|
||||
import com.jsh.erp.datasource.entities.*;
|
||||
import com.jsh.erp.datasource.entities.Material;
|
||||
import com.jsh.erp.datasource.entities.Unit;
|
||||
import com.jsh.erp.datasource.entities.UnitExample;
|
||||
import com.jsh.erp.datasource.entities.User;
|
||||
import com.jsh.erp.datasource.mappers.MaterialMapperEx;
|
||||
import com.jsh.erp.datasource.mappers.UnitMapper;
|
||||
import com.jsh.erp.datasource.mappers.UnitMapperEx;
|
||||
@@ -68,7 +70,7 @@ public class UnitService {
|
||||
|
||||
public List<Unit> getUnit()throws Exception {
|
||||
UnitExample example = new UnitExample();
|
||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
example.createCriteria().andEnabledEqualTo(true).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
List<Unit> list=null;
|
||||
try{
|
||||
list=unitMapper.selectByExample(example);
|
||||
@@ -104,6 +106,7 @@ public class UnitService {
|
||||
int result=0;
|
||||
try{
|
||||
parseNameByUnit(unit);
|
||||
unit.setEnabled(true);
|
||||
result=unitMapper.insertSelective(unit);
|
||||
logService.insertLog("计量单位",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(unit.getName()).toString(), request);
|
||||
@@ -245,4 +248,23 @@ public class UnitService {
|
||||
}
|
||||
return stock;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchSetStatus(Boolean status, String ids)throws Exception {
|
||||
logService.insertLog("计量单位",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ENABLED).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
List<Long> unitIds = StringUtil.strToLongList(ids);
|
||||
Unit unit = new Unit();
|
||||
unit.setEnabled(status);
|
||||
UnitExample example = new UnitExample();
|
||||
example.createCriteria().andIdIn(unitIds);
|
||||
int result=0;
|
||||
try{
|
||||
result = unitMapper.updateByExampleSelective(unit, example);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user