更新后端,采用Springboot+mybatis

This commit is contained in:
季圣华
2018-12-19 23:54:53 +08:00
parent bb6f5528a7
commit 5cc26a22f2
1672 changed files with 52804 additions and 156085 deletions

View File

@@ -0,0 +1,74 @@
package com.jsh.erp.service.inOutItem;
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 = "inOutItem_component")
@InOutItemResource
public class InOutItemComponent implements ICommonQuery {
@Resource
private InOutItemService inOutItemService;
@Override
public Object selectOne(String condition) {
return null;
}
@Override
public List<?> select(Map<String, String> map) {
return getFunctionsList(map);
}
private List<?> getFunctionsList(Map<String, String> map) {
String search = map.get(Constants.SEARCH);
String name = StringUtil.getInfo(search, "name");
String type = StringUtil.getInfo(search, "type");
String remark = StringUtil.getInfo(search, "remark");
String order = QueryUtils.order(map);
return inOutItemService.select(name, type, remark, QueryUtils.offset(map), QueryUtils.rows(map));
}
@Override
public int counts(Map<String, String> map) {
String search = map.get(Constants.SEARCH);
String name = StringUtil.getInfo(search, "name");
String type = StringUtil.getInfo(search, "type");
String remark = StringUtil.getInfo(search, "remark");
return inOutItemService.countInOutItem(name, type, remark);
}
@Override
public int insert(String beanJson, HttpServletRequest request) {
return inOutItemService.insertInOutItem(beanJson, request);
}
@Override
public int update(String beanJson, Long id) {
return inOutItemService.updateInOutItem(beanJson, id);
}
@Override
public int delete(Long id) {
return inOutItemService.deleteInOutItem(id);
}
@Override
public int batchDelete(String ids) {
return inOutItemService.batchDeleteInOutItem(ids);
}
@Override
public int checkIsNameExist(Long id, String name) {
return inOutItemService.checkIsNameExist(id, name);
}
}

View File

@@ -0,0 +1,15 @@
package com.jsh.erp.service.inOutItem;
import com.jsh.erp.service.ResourceInfo;
import java.lang.annotation.*;
/**
* @author jishenghua qq752718920 2018-10-7 15:26:27
*/
@ResourceInfo(value = "inOutItem", type = 35)
@Inherited
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface InOutItemResource {
}

View File

@@ -0,0 +1,79 @@
package com.jsh.erp.service.inOutItem;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.datasource.entities.InOutItem;
import com.jsh.erp.datasource.entities.InOutItemExample;
import com.jsh.erp.datasource.mappers.InOutItemMapper;
import com.jsh.erp.utils.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@Service
public class InOutItemService {
private Logger logger = LoggerFactory.getLogger(InOutItemService.class);
@Resource
private InOutItemMapper inOutItemMapper;
public InOutItem getInOutItem(long id) {
return inOutItemMapper.selectByPrimaryKey(id);
}
public List<InOutItem> getInOutItem() {
InOutItemExample example = new InOutItemExample();
return inOutItemMapper.selectByExample(example);
}
public List<InOutItem> select(String name, String type, String remark, int offset, int rows) {
return inOutItemMapper.selectByConditionInOutItem(name, type, remark, offset, rows);
}
public int countInOutItem(String name, String type, String remark) {
return inOutItemMapper.countsByInOutItem(name, type, remark);
}
public int insertInOutItem(String beanJson, HttpServletRequest request) {
InOutItem depot = JSONObject.parseObject(beanJson, InOutItem.class);
return inOutItemMapper.insertSelective(depot);
}
public int updateInOutItem(String beanJson, Long id) {
InOutItem depot = JSONObject.parseObject(beanJson, InOutItem.class);
depot.setId(id);
return inOutItemMapper.updateByPrimaryKeySelective(depot);
}
public int deleteInOutItem(Long id) {
return inOutItemMapper.deleteByPrimaryKey(id);
}
public int batchDeleteInOutItem(String ids) {
List<Long> idList = StringUtil.strToLongList(ids);
InOutItemExample example = new InOutItemExample();
example.createCriteria().andIdIn(idList);
return inOutItemMapper.deleteByExample(example);
}
public int checkIsNameExist(Long id, String name) {
InOutItemExample example = new InOutItemExample();
example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name);
List<InOutItem> list = inOutItemMapper.selectByExample(example);
return list.size();
}
public List<InOutItem> findBySelect(String type) {
InOutItemExample example = new InOutItemExample();
if (type.equals("in")) {
example.createCriteria().andTypeEqualTo("收入");
} else if (type.equals("out")) {
example.createCriteria().andTypeEqualTo("支出");
}
example.setOrderByClause("id desc");
return inOutItemMapper.selectByExample(example);
}
}