| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- package cn.com.goldenwater.dcproj.controller.tac;
- import cn.com.goldenwater.core.web.BaseController;
- import cn.com.goldenwater.core.web.BaseResponse;
- import cn.com.goldenwater.dcproj.model.TacSlbLawContent;
- import cn.com.goldenwater.dcproj.param.TacSlbLawContentParam;
- import cn.com.goldenwater.dcproj.service.TacSlbLawContentService;
- import cn.com.goldenwater.id.util.UuidUtil;
- import com.github.pagehelper.PageInfo;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import io.swagger.annotations.ApiParam;
- import org.apache.commons.lang3.StringUtils;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.util.List;
- /**
- * @author lune
- * @date 2019-9-25
- */
- @Api(value = "TAC 法律法规引用详情管理", tags = "TAC 法律法规引用详情管理")
- @RestController
- @RequestMapping("/tac/slb/law/content")
- public class TacSlbLawContentController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private TacSlbLawContentService tacSlbLawContentService;
- @ApiOperation(value = "添加/修改")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<TacSlbLawContent> insert(@ApiParam(name = "tacSlbLawContent", value = "TacSlbLawContent", required = true) @RequestBody TacSlbLawContent tacSlbLawContent) {
- if (StringUtils.isBlank(tacSlbLawContent.getId())) {
- String uuid = UuidUtil.uuid(); // 生成uuid
- tacSlbLawContent.setId(uuid);
- tacSlbLawContentService.insert(tacSlbLawContent);
- } else {
- tacSlbLawContentService.update(tacSlbLawContent);
- }
- return buildSuccessResponse(tacSlbLawContent);
- }
- @ApiOperation(value = "根据ID删除")
- @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
- public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- int ret = tacSlbLawContentService.delete(id);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据ID获取(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<TacSlbLawContent> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- TacSlbLawContent tacSlbLawContent = tacSlbLawContentService.get(id);
- return buildSuccessResponse(tacSlbLawContent);
- }
- @ApiOperation(value = "获取(列表所有)")
- @RequestMapping(value = "/list", method = RequestMethod.POST)
- public BaseResponse<List<TacSlbLawContent>> list(@ApiParam(name = "tacSlbLawContentParam", value = "tacSlbLawContentParam", required = true) @RequestBody TacSlbLawContentParam tacSlbLawContentParam) {
- List<TacSlbLawContent> tacSlbLawContentList = tacSlbLawContentService.findList(tacSlbLawContentParam);
- return buildSuccessResponse(tacSlbLawContentList);
- }
- @ApiOperation(value = "获取(列表--分页)")
- @RequestMapping(value = "/page", method = RequestMethod.POST)
- public BaseResponse<PageInfo<TacSlbLawContent>> page(@ApiParam(name = "tacSlbLawContentParam", value = "tacSlbLawContentParam", required = true) @RequestBody TacSlbLawContentParam tacSlbLawContentParam) {
- PageInfo<TacSlbLawContent> tacSlbLawContentList = tacSlbLawContentService.findPageInfo(tacSlbLawContentParam);
- return buildSuccessResponse(tacSlbLawContentList);
- }
- @ApiOperation(value = "获取(根据目录id获取章节)")
- @RequestMapping(value = "/list/{indexId}", method = RequestMethod.GET)
- public BaseResponse<List<TacSlbLawContent>> findChapters(@PathVariable(required = true) int indexId) {
- List<TacSlbLawContent> tacSlbLawIndexList = tacSlbLawContentService.findChapters(indexId);
- return buildSuccessResponse(tacSlbLawIndexList);
- }
- @ApiOperation(value = "获取(根据目录id,章节id(sort)获取条目)")
- @RequestMapping(value = "/list/{indexId}/{sort}", method = RequestMethod.GET)
- public BaseResponse<List<TacSlbLawContent>> findLine(@PathVariable(required = true) int indexId, @PathVariable(required = true) int sort) {
- TacSlbLawContentParam contentParam = new TacSlbLawContentParam();
- contentParam.setSort(sort);
- contentParam.setIndexId(indexId);
- List<TacSlbLawContent> tacSlbLawIndexList = tacSlbLawContentService.findList(contentParam);
- return buildSuccessResponse(tacSlbLawIndexList);
- }
- }
|