给日志、菜单等页面优化接口

This commit is contained in:
jishenghua
2025-02-23 09:54:00 +08:00
parent a73a8d2db2
commit db090f8dd5
22 changed files with 275 additions and 431 deletions

View File

@@ -1,72 +0,0 @@
package com.jsh.erp.service.msg;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.service.ICommonQuery;
import com.jsh.erp.utils.Constants;
import com.jsh.erp.utils.QueryUtils;
import com.jsh.erp.utils.StringUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
@Service(value = "msg_component")
@MsgResource
public class MsgComponent implements ICommonQuery {
@Resource
private MsgService msgService;
@Override
public Object selectOne(Long id) throws Exception {
return msgService.getMsg(id);
}
@Override
public List<?> select(Map<String, String> map)throws Exception {
return getMsgList(map);
}
private List<?> getMsgList(Map<String, String> map) throws Exception{
String search = map.get(Constants.SEARCH);
String name = StringUtil.getInfo(search, "name");
String order = QueryUtils.order(map);
String filter = QueryUtils.filter(map);
return msgService.select(name, QueryUtils.offset(map), QueryUtils.rows(map));
}
@Override
public Long counts(Map<String, String> map) throws Exception{
String search = map.get(Constants.SEARCH);
String name = StringUtil.getInfo(search, "name");
return msgService.countMsg(name);
}
@Override
public int insert(JSONObject obj, HttpServletRequest request)throws Exception {
return msgService.insertMsg(obj, request);
}
@Override
public int update(JSONObject obj, HttpServletRequest request)throws Exception {
return msgService.updateMsg(obj, request);
}
@Override
public int delete(Long id, HttpServletRequest request)throws Exception {
return msgService.deleteMsg(id, request);
}
@Override
public int deleteBatch(String ids, HttpServletRequest request)throws Exception {
return msgService.batchDeleteMsg(ids, request);
}
@Override
public int checkIsNameExist(Long id, String name)throws Exception {
return msgService.checkIsNameExist(id, name);
}
}

View File

@@ -1,15 +0,0 @@
package com.jsh.erp.service.msg;
import com.jsh.erp.service.ResourceInfo;
import java.lang.annotation.*;
/**
* @author jishenghua qq752718920 2019-9-7 22:52:35
*/
@ResourceInfo(value = "msg")
@Inherited
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface MsgResource {
}

View File

@@ -14,6 +14,7 @@ import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.depotHead.DepotHeadService;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.PageUtils;
import com.jsh.erp.utils.StringUtil;
import com.jsh.erp.utils.Tools;
import org.slf4j.Logger;
@@ -77,12 +78,13 @@ public class MsgService {
return list;
}
public List<MsgEx> select(String name, int offset, int rows)throws Exception {
public List<MsgEx> select(String name)throws Exception {
List<MsgEx> list=null;
try{
User userInfo = userService.getCurrentUser();
if(!BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) {
list = msgMapperEx.selectByConditionMsg(userInfo.getId(), name, offset, rows);
PageUtils.startPage();
list = msgMapperEx.selectByConditionMsg(userInfo.getId(), name);
if (null != list) {
for (MsgEx msgEx : list) {
if (msgEx.getCreateTime() != null) {
@@ -100,22 +102,6 @@ public class MsgService {
return list;
}
public Long countMsg(String name)throws Exception {
Long result=null;
try{
User userInfo = userService.getCurrentUser();
if(!BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) {
result = msgMapperEx.countsByMsg(userInfo.getId(), name);
}
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int insertMsg(JSONObject obj, HttpServletRequest request)throws Exception {
Msg msg = JSONObject.parseObject(obj.toJSONString(), Msg.class);