7 changed files with 259 additions and 0 deletions
@ -0,0 +1,110 @@ |
|||
package com.qs.serve.modules.bms.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.bms.entity.BmsSubjectForm; |
|||
import com.qs.serve.modules.bms.service.BmsSubjectFormService; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 基础档案 科目表单 |
|||
* @author YenHex |
|||
* @since 2023-02-03 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("bms/subjectForm") |
|||
public class BmsSubjectFormController { |
|||
|
|||
private BmsSubjectFormService bmsSubjectFormService; |
|||
|
|||
|
|||
/** |
|||
* 翻页 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page") |
|||
@PreAuthorize("hasRole('bms:subjectForm:query')") |
|||
public R<PageVo<BmsSubjectForm>> getPage(BmsSubjectForm param){ |
|||
BmsSubjectForm entity = CopierUtil.copy(param,new BmsSubjectForm()); |
|||
LambdaQueryWrapper<BmsSubjectForm> lqw = new LambdaQueryWrapper<>(entity); |
|||
PageUtil.startPage(); |
|||
List<BmsSubjectForm> list = bmsSubjectFormService.list(lqw); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "科目表单", biz = BizType.QUERY) |
|||
@PreAuthorize("hasRole('bms:subject:query')") |
|||
public R<BmsSubjectForm> getById(@PathVariable("id") String id){ |
|||
BmsSubjectForm bmsSubjectForm = bmsSubjectFormService.getById(id); |
|||
return R.ok(bmsSubjectForm); |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 更新 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateById") |
|||
@SysLog(module = SystemModule.BASE, title = "科目表单", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('bms:subject:update')") |
|||
public R<?> updateById(@RequestBody @Valid BmsSubjectForm param){ |
|||
BmsSubjectForm entity = CopierUtil.copy(param,new BmsSubjectForm()); |
|||
boolean result = bmsSubjectFormService.updateById(entity); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
@SysLog(module = SystemModule.BASE, title = "科目表单", biz = BizType.INSERT) |
|||
@PreAuthorize("hasRole('bms:subject:insert')") |
|||
public R<?> save(@RequestBody @Valid BmsSubjectForm param){ |
|||
BmsSubjectForm entity = CopierUtil.copy(param,new BmsSubjectForm()); |
|||
boolean result = bmsSubjectFormService.save(entity); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
* @param ids |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{ids}") |
|||
@SysLog(module = SystemModule.BASE, title = "科目表单", biz = BizType.DELETE) |
|||
@PreAuthorize("hasRole('bms:subject:delete')") |
|||
public R<?> deleteById(@PathVariable("ids") String ids){ |
|||
List<Long> idsLong = StringUtils.splitIdLong(ids); |
|||
boolean result = bmsSubjectFormService.removeByIds(idsLong); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,86 @@ |
|||
package com.qs.serve.modules.bms.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-02-03 |
|||
*/ |
|||
@Data |
|||
@TableName("bms_subject_form") |
|||
public class BmsSubjectForm implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 标题 */ |
|||
@NotBlank(message = "标题不能为空") |
|||
@Length(max = 40,message = "标题长度不能超过40字") |
|||
private String title; |
|||
|
|||
/** 子标题 */ |
|||
@Length(max = 255,message = "子标题长度不能超过255字") |
|||
private String subtitle; |
|||
|
|||
/** 描述 */ |
|||
@Length(max = 255,message = "描述长度不能超过255字") |
|||
private String descr; |
|||
|
|||
/** 表单json */ |
|||
@NotBlank(message = "表单json不能为空") |
|||
@Length(max = 0,message = "表单json长度不能超过0字") |
|||
private String formContext; |
|||
|
|||
/** 表单版本 */ |
|||
private Integer version; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
/** 租户id */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 删除标识 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private Boolean delFlag; |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.bms.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.bms.entity.BmsSubjectForm; |
|||
|
|||
/** |
|||
* 科目表单 Mapper |
|||
* @author YenHex |
|||
* @date 2023-02-03 |
|||
*/ |
|||
public interface BmsSubjectFormMapper extends BaseMapper<BmsSubjectForm> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.bms.service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.qs.serve.modules.bms.entity.BmsSubjectForm; |
|||
|
|||
/** |
|||
* 科目表单 服务接口 |
|||
* @author YenHex |
|||
* @date 2023-02-03 |
|||
*/ |
|||
public interface BmsSubjectFormService extends IService<BmsSubjectForm> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,22 @@ |
|||
package com.qs.serve.modules.bms.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.bms.entity.BmsSubjectForm; |
|||
import com.qs.serve.modules.bms.service.BmsSubjectFormService; |
|||
import com.qs.serve.modules.bms.mapper.BmsSubjectFormMapper; |
|||
|
|||
/** |
|||
* 科目表单 服务实现类 |
|||
* @author YenHex |
|||
* @since 2023-02-03 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class BmsSubjectFormServiceImpl extends ServiceImpl<BmsSubjectFormMapper,BmsSubjectForm> implements BmsSubjectFormService { |
|||
|
|||
} |
|||
|
Loading…
Reference in new issue