提交 79f19625 authored 作者: liupengfei's avatar liupengfei

--no commit message

上级 b0b5fa69
package com.zrqx.sysuser.bg.controller.dictionary;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zrqx.core.constant.sysuser.SysUserRequestPath;
import com.zrqx.core.enums.sysuser.dictionary.DictonaryCodeEnum;
import com.zrqx.core.form.sysuser.bg.dictionary.DictionaryPageForm;
import com.zrqx.core.model.sysuser.dictionary.Dictionary;
import com.zrqx.core.util.page.PageInfo;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.core.util.response.CallBack;
import com.zrqx.sysuser.bg.service.dictionary.DictionaryService;
/**
* 数据字典 Controller
*/
@RestController
@RequestMapping(SysUserRequestPath.BG + SysUserRequestPath.DICTIONARY)
@Api(description = "系统管理-数据字典")
public class DictionaryController {
@Autowired
private DictionaryService dictionaryService;
@ApiOperation(value = "查询数据字典", notes = "按条件分页查询数据字典")
@GetMapping(SysUserRequestPath.PAGE)
public CallBack<PageInfo<Dictionary>> getPageList(DictionaryPageForm entity, PageParam pageParam) {
return CallBack.success(dictionaryService.queryByCriteria(entity, pageParam));
}
@ApiOperation(value = "查询数据字典" , notes = "根据数据字典ID查询一个页脚")
@ApiImplicitParam(name = "id" , value = "数据字典id" , dataType = "int" , paramType = "path" , required = true)
@GetMapping(value = "/{id}")
public CallBack<Dictionary> get(@PathVariable Integer id){
return CallBack.success(dictionaryService.selectByPrimaryKey(id));
}
@ApiOperation(value = "新增数据字典", notes = "新增一个数据字典")
@PostMapping(SysUserRequestPath.SAVE)
public CallBack<Boolean> save(@RequestBody Dictionary entity) {
entity.setCreateTime(new Date());
return CallBack.success(dictionaryService.insert(entity));
}
@ApiOperation(value = "更新数据字典", notes = "根据数据字典ID更新一个数据字典,空值默认不更新")
@PostMapping(SysUserRequestPath.UPDATE)
public CallBack<Boolean> update(@RequestBody Dictionary entity) {
entity.setUpdateTime(new Date());
return CallBack.success(dictionaryService.updateByPrimaryKeySelective(entity));
}
@ApiOperation(value = "批量更新数据字典", notes = "根据数据字典对象集合更新")
@PostMapping(SysUserRequestPath.BATCH_UPDATE)
public CallBack<Boolean> batchUpdate(@RequestBody List<Dictionary> entitys) {
for (Dictionary dictionary : entitys) {
dictionary.setUpdateTime(new Date());
dictionaryService.updateByPrimaryKeySelective(dictionary);
}
return CallBack.success();
}
@ApiOperation(value = "删除数据字典", notes = "根据数据字典ID删除一个数据字典")
@PostMapping(SysUserRequestPath.DELETE_OID)
public CallBack<Boolean> delete(@PathVariable Integer oid) {
return CallBack.success(dictionaryService.deleteByPrimaryKey(oid));
}
@ApiOperation(value = "删除数据字典", notes = "批量删除数据字典")
@PostMapping(SysUserRequestPath.BATCH_DELETE)
public CallBack<Boolean> deletes(@RequestBody Integer[] id) {
dictionaryService.createCriteria().andIn("id", Arrays.asList(id));
return CallBack.success(dictionaryService.deleteByCriteria());
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论