5 changed files with 232 additions and 0 deletions
@ -0,0 +1,124 @@ |
|||
package com.qs.serve.modules.sys.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.model.annotation.SysLog; |
|||
import com.qs.serve.common.model.dto.PageVo; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.model.enums.BizType; |
|||
import com.qs.serve.common.model.enums.SystemModule; |
|||
import com.qs.serve.common.util.PageUtil; |
|||
import com.qs.serve.common.util.CopierUtil; |
|||
import com.qs.serve.common.util.StringUtils; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.qs.serve.modules.sys.entity.SysOperationManual; |
|||
import com.qs.serve.modules.sys.service.SysOperationManualService; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 系统 |
|||
* @author YenHex |
|||
* @since 2023-08-11 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("sys/operationManual") |
|||
public class SysOperationManualController { |
|||
|
|||
private SysOperationManualService sysOperationManualService; |
|||
|
|||
/** |
|||
* 列表 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/list") |
|||
//@PreAuthorize("hasRole('sys:operationManual:query')")
|
|||
public R<List<SysOperationManual>> getList(SysOperationManual param){ |
|||
SysOperationManual entity = CopierUtil.copy(param,new SysOperationManual()); |
|||
LambdaQueryWrapper<SysOperationManual> lqw = new LambdaQueryWrapper<>(entity); |
|||
PageUtil.startPage(); |
|||
List<SysOperationManual> list = sysOperationManualService.list(lqw); |
|||
return R.ok(list); |
|||
} |
|||
|
|||
/** |
|||
* 翻页 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page") |
|||
//@PreAuthorize("hasRole('sys:operationManual:query')")
|
|||
public R<PageVo<SysOperationManual>> getPage(SysOperationManual param){ |
|||
SysOperationManual entity = CopierUtil.copy(param,new SysOperationManual()); |
|||
LambdaQueryWrapper<SysOperationManual> lqw = new LambdaQueryWrapper<>(entity); |
|||
PageUtil.startPage(); |
|||
List<SysOperationManual> list = sysOperationManualService.list(lqw); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
// @SysLog(module = SystemModule.${extend.moduleLog}, title = "", biz = BizType.QUERY)
|
|||
//@PreAuthorize("hasRole('sys:operationManual:query')")
|
|||
public R<SysOperationManual> getById(@PathVariable("id") String id){ |
|||
SysOperationManual sysOperationManual = sysOperationManualService.getById(id); |
|||
return R.ok(sysOperationManual); |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 更新 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateById") |
|||
// @SysLog(module = SystemModule.${extend.moduleLog}, title = "", biz = BizType.UPDATE)
|
|||
//@PreAuthorize("hasRole('sys:operationManual:update')")
|
|||
public R<?> updateById(@RequestBody @Valid SysOperationManual param){ |
|||
SysOperationManual entity = CopierUtil.copy(param,new SysOperationManual()); |
|||
boolean result = sysOperationManualService.updateById(entity); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
// @SysLog(module = SystemModule.${extend.moduleLog}, title = "", biz = BizType.INSERT)
|
|||
//@PreAuthorize("hasRole('sys:operationManual:insert')")
|
|||
public R<?> save(@RequestBody @Valid SysOperationManual param){ |
|||
SysOperationManual entity = CopierUtil.copy(param,new SysOperationManual()); |
|||
boolean result = sysOperationManualService.save(entity); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
* @param ids |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{ids}") |
|||
// @SysLog(module = SystemModule.${extend.moduleLog}, title = "", biz = BizType.DELETE)
|
|||
//@PreAuthorize("hasRole('sys:operationManual:delete')")
|
|||
public R<?> deleteById(@PathVariable("ids") String ids){ |
|||
List<Long> idsLong = StringUtils.splitIdLong(ids); |
|||
boolean result = sysOperationManualService.removeByIds(idsLong); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,58 @@ |
|||
package com.qs.serve.modules.sys.entity; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 实体类 |
|||
* @author YenHex |
|||
* @since 2023-08-11 |
|||
*/ |
|||
@Data |
|||
@TableName("sys_operation_manual") |
|||
public class SysOperationManual implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** */ |
|||
@Length(max = 255,message = "长度不能超过255字") |
|||
private String name; |
|||
|
|||
/** */ |
|||
@Length(max = 255,message = "长度不能超过255字") |
|||
private String url; |
|||
|
|||
/** */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String delFlag; |
|||
|
|||
|
|||
public static SysOperationManual toNewObject(SysOperationManual source){ |
|||
SysOperationManual operationManual = new SysOperationManual(); |
|||
operationManual.setId(source.getId()); |
|||
operationManual.setName(source.getName()); |
|||
operationManual.setUrl(source.getUrl()); |
|||
operationManual.setDelFlag(source.getDelFlag()); |
|||
return operationManual; |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.sys.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.sys.entity.SysOperationManual; |
|||
|
|||
/** |
|||
* Mapper |
|||
* @author YenHex |
|||
* @date 2023-08-11 |
|||
*/ |
|||
public interface SysOperationManualMapper extends BaseMapper<SysOperationManual> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.sys.service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.qs.serve.modules.sys.entity.SysOperationManual; |
|||
|
|||
/** |
|||
* 服务接口 |
|||
* @author YenHex |
|||
* @date 2023-08-11 |
|||
*/ |
|||
public interface SysOperationManualService extends IService<SysOperationManual> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,22 @@ |
|||
package com.qs.serve.modules.sys.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
import com.qs.serve.modules.sys.entity.SysOperationManual; |
|||
import com.qs.serve.modules.sys.service.SysOperationManualService; |
|||
import com.qs.serve.modules.sys.mapper.SysOperationManualMapper; |
|||
|
|||
/** |
|||
* 服务实现类 |
|||
* @author YenHex |
|||
* @since 2023-08-11 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class SysOperationManualServiceImpl extends ServiceImpl<SysOperationManualMapper,SysOperationManual> implements SysOperationManualService { |
|||
|
|||
} |
|||
|
Loading…
Reference in new issue