更新后端,采用Springboot+mybatis
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
package com.jsh.erp.service.systemConfig;
|
||||
|
||||
import com.jsh.erp.service.ICommonQuery;
|
||||
import com.jsh.erp.service.systemConfig.SystemConfigResource;
|
||||
import com.jsh.erp.service.systemConfig.SystemConfigService;
|
||||
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 = "systemConfig_component")
|
||||
@SystemConfigResource
|
||||
public class SystemConfigComponent implements ICommonQuery {
|
||||
|
||||
@Resource
|
||||
private SystemConfigService systemConfigService;
|
||||
|
||||
@Override
|
||||
public Object selectOne(String condition) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<?> select(Map<String, String> map) {
|
||||
return getSystemConfigList(map);
|
||||
}
|
||||
|
||||
private List<?> getSystemConfigList(Map<String, String> map) {
|
||||
String order = QueryUtils.order(map);
|
||||
return systemConfigService.select(QueryUtils.offset(map), QueryUtils.rows(map));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int counts(Map<String, String> map) {
|
||||
return systemConfigService.countSystemConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(String beanJson, HttpServletRequest request) {
|
||||
return systemConfigService.insertSystemConfig(beanJson, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(String beanJson, Long id) {
|
||||
return systemConfigService.updateSystemConfig(beanJson, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id) {
|
||||
return systemConfigService.deleteSystemConfig(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int batchDelete(String ids) {
|
||||
return systemConfigService.batchDeleteSystemConfig(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkIsNameExist(Long id, String name) {
|
||||
return systemConfigService.checkIsNameExist(id, name);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.jsh.erp.service.systemConfig;
|
||||
|
||||
import com.jsh.erp.service.ResourceInfo;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author jishenghua qq752718920 2018-10-7 15:26:27
|
||||
*/
|
||||
@ResourceInfo(value = "systemConfig", type = 55)
|
||||
@Inherited
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface SystemConfigResource {
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.jsh.erp.service.systemConfig;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.datasource.entities.SystemConfig;
|
||||
import com.jsh.erp.datasource.entities.SystemConfigExample;
|
||||
import com.jsh.erp.datasource.mappers.SystemConfigMapper;
|
||||
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 SystemConfigService {
|
||||
private Logger logger = LoggerFactory.getLogger(SystemConfigService.class);
|
||||
|
||||
@Resource
|
||||
private SystemConfigMapper systemConfigMapper;
|
||||
|
||||
public SystemConfig getSystemConfig(long id) {
|
||||
return systemConfigMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public List<SystemConfig> getSystemConfig() {
|
||||
SystemConfigExample example = new SystemConfigExample();
|
||||
return systemConfigMapper.selectByExample(example);
|
||||
}
|
||||
public List<SystemConfig> select(int offset, int rows) {
|
||||
return systemConfigMapper.selectByConditionSystemConfig(offset, rows);
|
||||
}
|
||||
|
||||
public int countSystemConfig() {
|
||||
return systemConfigMapper.countsBySystemConfig();
|
||||
}
|
||||
|
||||
public int insertSystemConfig(String beanJson, HttpServletRequest request) {
|
||||
SystemConfig systemConfig = JSONObject.parseObject(beanJson, SystemConfig.class);
|
||||
return systemConfigMapper.insertSelective(systemConfig);
|
||||
}
|
||||
|
||||
public int updateSystemConfig(String beanJson, Long id) {
|
||||
SystemConfig systemConfig = JSONObject.parseObject(beanJson, SystemConfig.class);
|
||||
systemConfig.setId(id);
|
||||
return systemConfigMapper.updateByPrimaryKeySelective(systemConfig);
|
||||
}
|
||||
|
||||
public int deleteSystemConfig(Long id) {
|
||||
return systemConfigMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public int batchDeleteSystemConfig(String ids) {
|
||||
List<Long> idList = StringUtil.strToLongList(ids);
|
||||
SystemConfigExample example = new SystemConfigExample();
|
||||
example.createCriteria().andIdIn(idList);
|
||||
return systemConfigMapper.deleteByExample(example);
|
||||
}
|
||||
|
||||
public int checkIsNameExist(Long id, String name) {
|
||||
SystemConfigExample example = new SystemConfigExample();
|
||||
example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name);
|
||||
List<SystemConfig> list = systemConfigMapper.selectByExample(example);
|
||||
return list.size();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user