|
@ -7,7 +7,6 @@ import com.yihu.jw.entity.base.system.SystemDictDO;
|
|
import com.yihu.jw.restmodel.base.system.SystemDictVO;
|
|
import com.yihu.jw.restmodel.base.system.SystemDictVO;
|
|
import com.yihu.jw.restmodel.web.Envelop;
|
|
import com.yihu.jw.restmodel.web.Envelop;
|
|
import com.yihu.jw.restmodel.web.ListEnvelop;
|
|
import com.yihu.jw.restmodel.web.ListEnvelop;
|
|
import com.yihu.jw.restmodel.web.ObjEnvelop;
|
|
|
|
import com.yihu.jw.restmodel.web.PageEnvelop;
|
|
import com.yihu.jw.restmodel.web.PageEnvelop;
|
|
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
|
|
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
|
|
import com.yihu.jw.rm.base.BaseRequestMapping;
|
|
import com.yihu.jw.rm.base.BaseRequestMapping;
|
|
@ -16,7 +15,6 @@ import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiParam;
|
|
import io.swagger.annotations.ApiParam;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.http.MediaType;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@ -29,20 +27,10 @@ import java.util.List;
|
|
@RequestMapping(value = BaseRequestMapping.SystemDict.PREFIX)
|
|
@RequestMapping(value = BaseRequestMapping.SystemDict.PREFIX)
|
|
@Api(value = "系统字典", description = "系统字典服务接口", tags = {"wlyy基础服务 - 系统字典服务接口"})
|
|
@Api(value = "系统字典", description = "系统字典服务接口", tags = {"wlyy基础服务 - 系统字典服务接口"})
|
|
public class SystemDictEndpoint extends EnvelopRestEndpoint {
|
|
public class SystemDictEndpoint extends EnvelopRestEndpoint {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private SystemDictService systemDictService;
|
|
private SystemDictService systemDictService;
|
|
|
|
|
|
@PostMapping(value = BaseRequestMapping.SystemDict.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
|
@ApiOperation(value = "创建")
|
|
|
|
public ObjEnvelop<SystemDictVO> create (
|
|
|
|
@ApiParam(name = "json", value = "Json数据", required = true)
|
|
|
|
@RequestBody String jsonData) throws Exception {
|
|
|
|
SystemDictDO systemDictDO = toEntity(jsonData, SystemDictDO.class);
|
|
|
|
systemDictDO = systemDictService.save(systemDictDO);
|
|
|
|
return success(systemDictDO, SystemDictVO.class);
|
|
|
|
}
|
|
|
|
|
|
|
|
@PostMapping(value = BaseRequestMapping.SystemDict.DELETE)
|
|
@PostMapping(value = BaseRequestMapping.SystemDict.DELETE)
|
|
@ApiOperation(value = "删除")
|
|
@ApiOperation(value = "删除")
|
|
public Envelop delete(
|
|
public Envelop delete(
|
|
@ -52,11 +40,11 @@ public class SystemDictEndpoint extends EnvelopRestEndpoint {
|
|
return success("删除成功");
|
|
return success("删除成功");
|
|
}
|
|
}
|
|
|
|
|
|
@PostMapping(value = BaseRequestMapping.SystemDict.UPDATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
|
|
|
@PostMapping(value = BaseRequestMapping.SystemDict.UPDATE)
|
|
@ApiOperation(value = "更新")
|
|
@ApiOperation(value = "更新")
|
|
public Envelop update (
|
|
|
|
|
|
public Envelop update(
|
|
@ApiParam(name = "json", value = "Json数据", required = true)
|
|
@ApiParam(name = "json", value = "Json数据", required = true)
|
|
@RequestBody String jsonData) throws Exception {
|
|
|
|
|
|
@RequestParam String jsonData) throws Exception {
|
|
SystemDictDO systemDictDO = toEntity(jsonData, SystemDictDO.class);
|
|
SystemDictDO systemDictDO = toEntity(jsonData, SystemDictDO.class);
|
|
if (null == systemDictDO.getCode()) {
|
|
if (null == systemDictDO.getCode()) {
|
|
return failed("ID不能为空", Envelop.class);
|
|
return failed("ID不能为空", Envelop.class);
|
|
@ -67,7 +55,7 @@ public class SystemDictEndpoint extends EnvelopRestEndpoint {
|
|
|
|
|
|
@GetMapping(value = BaseRequestMapping.SystemDict.PAGE)
|
|
@GetMapping(value = BaseRequestMapping.SystemDict.PAGE)
|
|
@ApiOperation(value = "获取分页")
|
|
@ApiOperation(value = "获取分页")
|
|
public PageEnvelop<SystemDictVO> page (
|
|
|
|
|
|
public PageEnvelop<SystemDictVO> page(
|
|
@ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
|
|
@ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
|
|
@RequestParam(value = "fields", required = false) String fields,
|
|
@RequestParam(value = "fields", required = false) String fields,
|
|
@ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
|
|
@ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
|
|
@ -79,13 +67,13 @@ public class SystemDictEndpoint extends EnvelopRestEndpoint {
|
|
@ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
|
|
@ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
|
|
@RequestParam(value = "size") int size) throws Exception {
|
|
@RequestParam(value = "size") int size) throws Exception {
|
|
List<SystemDictDO> systemDictDOS = systemDictService.search(fields, filters, sorts, page, size);
|
|
List<SystemDictDO> systemDictDOS = systemDictService.search(fields, filters, sorts, page, size);
|
|
int count = (int)systemDictService.getCount(filters);
|
|
|
|
|
|
int count = (int) systemDictService.getCount(filters);
|
|
return success(systemDictDOS, count, page, size, SystemDictVO.class);
|
|
return success(systemDictDOS, count, page, size, SystemDictVO.class);
|
|
}
|
|
}
|
|
|
|
|
|
@GetMapping(value = BaseRequestMapping.SystemDict.LIST)
|
|
@GetMapping(value = BaseRequestMapping.SystemDict.LIST)
|
|
@ApiOperation(value = "获取列表")
|
|
@ApiOperation(value = "获取列表")
|
|
public ListEnvelop<SystemDictVO> list (
|
|
|
|
|
|
public ListEnvelop<SystemDictVO> list(
|
|
@ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
|
|
@ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
|
|
@RequestParam(value = "fields", required = false) String fields,
|
|
@RequestParam(value = "fields", required = false) String fields,
|
|
@ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
|
|
@ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
|
|
@ -96,14 +84,14 @@ public class SystemDictEndpoint extends EnvelopRestEndpoint {
|
|
return success(systemDictDOS, SystemDictVO.class);
|
|
return success(systemDictDOS, SystemDictVO.class);
|
|
}
|
|
}
|
|
|
|
|
|
@GetMapping(value = BaseRequestMapping.SystemDict.ALL)
|
|
|
|
|
|
@PostMapping(value = BaseRequestMapping.SystemDict.CREATE)
|
|
@ApiOperation(value = "新增系统字典")
|
|
@ApiOperation(value = "新增系统字典")
|
|
public Envelop createSystemDict (
|
|
|
|
|
|
public Envelop createSystemDict(
|
|
@ApiParam(name = "jsonData", value = "json数据,系统字典及其值")
|
|
@ApiParam(name = "jsonData", value = "json数据,系统字典及其值")
|
|
@RequestParam(value = "jsonData", required = true) String jsonData) throws Exception {
|
|
@RequestParam(value = "jsonData", required = true) String jsonData) throws Exception {
|
|
String message = systemDictService.createSystemDict(jsonData);
|
|
|
|
if(StringUtils.equalsIgnoreCase(message,ConstantUtils.SUCCESS)){
|
|
|
|
return success(message);
|
|
|
|
|
|
String message = systemDictService.createSystemDict(jsonData);
|
|
|
|
if (StringUtils.equalsIgnoreCase(message, ConstantUtils.SUCCESS)) {
|
|
|
|
return success(message);
|
|
}
|
|
}
|
|
return failed(message);
|
|
return failed(message);
|
|
}
|
|
}
|
|
@ -122,7 +110,7 @@ public class SystemDictEndpoint extends EnvelopRestEndpoint {
|
|
@ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
|
|
@ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
|
|
@RequestParam(value = "size") int size
|
|
@RequestParam(value = "size") int size
|
|
) throws Exception {
|
|
) throws Exception {
|
|
JSONArray list = systemDictService.getDistListByType(type,userId,sorts,page,size);
|
|
|
|
|
|
JSONArray list = systemDictService.getDistListByType(type, userId, sorts, page, size);
|
|
return success(list);
|
|
return success(list);
|
|
}
|
|
}
|
|
}
|
|
}
|