更新后端,采用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,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;
}
}