更新后端,采用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,72 @@
package com.jsh.erp.service.app;
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 = "app_component")
@AppResource
public class AppComponent implements ICommonQuery {
@Resource
private AppService appService;
@Override
public Object selectOne(String condition) {
return null;
}
@Override
public List<?> select(Map<String, String> map) {
return getAppList(map);
}
private List<?> getAppList(Map<String, String> map) {
String search = map.get(Constants.SEARCH);
String name = StringUtil.getInfo(search, "name");
String type = StringUtil.getInfo(search, "type");
String order = QueryUtils.order(map);
return appService.select(name, type, 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");
return appService.countApp(name, type);
}
@Override
public int insert(String beanJson, HttpServletRequest request) {
return appService.insertApp(beanJson, request);
}
@Override
public int update(String beanJson, Long id) {
return appService.updateApp(beanJson, id);
}
@Override
public int delete(Long id) {
return appService.deleteApp(id);
}
@Override
public int batchDelete(String ids) {
return appService.batchDeleteApp(ids);
}
@Override
public int checkIsNameExist(Long id, String name) {
return 0;
}
}

View File

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

View File

@@ -0,0 +1,85 @@
package com.jsh.erp.service.app;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.datasource.entities.App;
import com.jsh.erp.datasource.entities.AppExample;
import com.jsh.erp.datasource.mappers.AppMapper;
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 AppService {
private Logger logger = LoggerFactory.getLogger(AppService.class);
@Resource
private AppMapper appMapper;
public List<App> findDock(){
AppExample example = new AppExample();
example.createCriteria().andZlEqualTo("dock").andEnabledEqualTo(true);
example.setOrderByClause("Sort");
List<App> list = appMapper.selectByExample(example);
return list;
}
public List<App> findDesk(){
AppExample example = new AppExample();
example.createCriteria().andZlEqualTo("desk").andEnabledEqualTo(true);
example.setOrderByClause("Sort");
List<App> list = appMapper.selectByExample(example);
return list;
}
public App getApp(long id) {
return appMapper.selectByPrimaryKey(id);
}
public List<App> getApp() {
AppExample example = new AppExample();
return appMapper.selectByExample(example);
}
public List<App> select(String name, String type, int offset, int rows) {
return appMapper.selectByConditionApp(name, type, offset, rows);
}
public int countApp(String name, String type) {
return appMapper.countsByApp(name, type);
}
public int insertApp(String beanJson, HttpServletRequest request) {
App app = JSONObject.parseObject(beanJson, App.class);
return appMapper.insertSelective(app);
}
public int updateApp(String beanJson, Long id) {
App app = JSONObject.parseObject(beanJson, App.class);
app.setId(id);
return appMapper.updateByPrimaryKeySelective(app);
}
public int deleteApp(Long id) {
return appMapper.deleteByPrimaryKey(id);
}
public int batchDeleteApp(String ids) {
List<Long> idList = StringUtil.strToLongList(ids);
AppExample example = new AppExample();
example.createCriteria().andIdIn(idList);
return appMapper.deleteByExample(example);
}
public List<App> findRoleAPP(){
AppExample example = new AppExample();
example.createCriteria().andEnabledEqualTo(true);
example.setOrderByClause("Sort");
List<App> list = appMapper.selectByExample(example);
return list;
}
}