|
@@ -1,130 +0,0 @@
|
|
-package com.txz.mall.web.mng;
|
|
|
|
-import com.txz.mall.core.Result;
|
|
|
|
-import com.txz.mall.model.CreateSequence;
|
|
|
|
-import com.txz.mall.service.CreateSequenceService;
|
|
|
|
-
|
|
|
|
-import com.txz.mall.core.ResultCode;
|
|
|
|
-
|
|
|
|
-import com.github.pagehelper.PageHelper;
|
|
|
|
-import com.github.pagehelper.PageInfo;
|
|
|
|
-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.RequestParam;
|
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
|
-import org.slf4j.Logger;
|
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
|
-import io.swagger.annotations.Api;
|
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
|
-import tk.mybatis.mapper.entity.Condition;
|
|
|
|
-import tk.mybatis.mapper.entity.Example.Criteria;
|
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
|
-import org.springframework.validation.annotation.Validated;
|
|
|
|
-import javax.annotation.Resource;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Date;
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
-* Created by CodeGenerator on 2025/09/10.
|
|
|
|
-*/
|
|
|
|
-@Api(tags = "[后台]createSequence管理")
|
|
|
|
-@RestController
|
|
|
|
-@RequestMapping("/create/sequence")
|
|
|
|
-public class CreateSequenceController {
|
|
|
|
-
|
|
|
|
- private static Logger log = LoggerFactory.getLogger(CreateSequenceController.class);
|
|
|
|
-
|
|
|
|
- @Resource
|
|
|
|
- private CreateSequenceService createSequenceService;
|
|
|
|
-
|
|
|
|
- @PostMapping("/add")
|
|
|
|
- @ApiOperation(value = "createSequence新增")
|
|
|
|
- public Result add(@RequestBody CreateSequence createSequence) {
|
|
|
|
- if(createSequence == null){
|
|
|
|
- return Result.fail(ResultCode.OBJECT_IS_NULL);
|
|
|
|
- }
|
|
|
|
- try {
|
|
|
|
- createSequence.setCreateTime(new Date());
|
|
|
|
-// createSequence.setCreateUserId(userId);
|
|
|
|
- createSequenceService.save(createSequence);
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- log.error("新增对象操作异常e:{}",e);
|
|
|
|
- return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
|
|
|
|
- }
|
|
|
|
- return Result.success();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @DeleteMapping("/delete")
|
|
|
|
- @ApiOperation(value = "createSequence删除")
|
|
|
|
- public Result delete(@RequestParam Long id) {
|
|
|
|
- if(id == null){
|
|
|
|
- return Result.fail(ResultCode.ID_IS_NULL);
|
|
|
|
- }
|
|
|
|
- try {
|
|
|
|
- CreateSequence createSequence = new CreateSequence();
|
|
|
|
- createSequence.setId(id);
|
|
|
|
- createSequence.setIsDelete(1);
|
|
|
|
- createSequenceService.update(createSequence);
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- log.error("删除对象操作异常e:{}",e);
|
|
|
|
- return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
|
|
|
|
- }
|
|
|
|
- return Result.success();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @PutMapping("/update")
|
|
|
|
- @ApiOperation(value = "createSequence更新")
|
|
|
|
- public Result update(@RequestBody CreateSequence createSequence) {
|
|
|
|
- if(createSequence == null){
|
|
|
|
- return Result.fail(ResultCode.OBJECT_IS_NULL);
|
|
|
|
- }
|
|
|
|
- if(createSequence.getId() == null){
|
|
|
|
- return Result.fail(ResultCode.ID_IS_NULL);
|
|
|
|
- }
|
|
|
|
- try {
|
|
|
|
- createSequence.setUpdateTime(new Date());
|
|
|
|
-// createSequence.setUpdateUserId(userId);
|
|
|
|
- createSequenceService.update(createSequence);
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- log.error("更新对象操作异常e:{}",e);
|
|
|
|
- return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
|
|
|
|
- }
|
|
|
|
- return Result.success();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @GetMapping("/detail")
|
|
|
|
- @ApiOperation(value = "createSequence获取详情")
|
|
|
|
- public Result<CreateSequence> detail(@RequestParam Long id) {
|
|
|
|
- if(id == null){
|
|
|
|
- return Result.fail(ResultCode.ID_IS_NULL);
|
|
|
|
- }
|
|
|
|
- CreateSequence createSequence = null;
|
|
|
|
- try {
|
|
|
|
- createSequence = createSequenceService.findById(id);
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- log.error("查询对象操作异常e:{}",e);
|
|
|
|
- return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
|
|
|
|
- }
|
|
|
|
- return Result.success(createSequence);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @PostMapping("/list")
|
|
|
|
- @ApiOperation(value = "createSequence获取列表")
|
|
|
|
- public Result<List<CreateSequence>> list(@Validated @RequestBody CreateSequenceDTO dto) {
|
|
|
|
- PageHelper.startPage(dto.getPage(), dto.getSize());
|
|
|
|
-
|
|
|
|
- Condition condition = new Condition(CreateSequence.class);
|
|
|
|
- Criteria criteria = condition.createCriteria();
|
|
|
|
- criteria.andEqualTo("isDelete", 0);
|
|
|
|
- condition.setOrderByClause("create_time DESC");
|
|
|
|
- PageInfo pageInfo = null;
|
|
|
|
- try {
|
|
|
|
- List<CreateSequence> list = createSequenceService.findByCondition(condition);
|
|
|
|
- pageInfo = new PageInfo(list);
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- log.error("查询对象操作异常e:{}",e);
|
|
|
|
- return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
|
|
|
|
- }
|
|
|
|
- return Result.success(pageInfo);
|
|
|
|
- }
|
|
|
|
-}
|
|
|