From d1bcbbefab4da603c275ed61d0018a46dbc67d1e Mon Sep 17 00:00:00 2001 From: 唐耀东 <18861537@qq.com> Date: 星期三, 12 十月 2022 16:31:51 +0800 Subject: [PATCH] 施工交付增加其他录入交付功能 --- ruoyi-oa/src/main/java/com/ruoyi/oa/mapper/SgOtherMapper.java | 14 + ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/SgOtherServiceImpl.java | 92 +++++++++ ruoyi-oa/src/main/java/com/ruoyi/oa/domain/bo/SgOtherBo.java | 101 ++++++++++ ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/SgOtherController.java | 118 +++++++++++ ruoyi-oa/src/main/java/com/ruoyi/oa/domain/SgOther.java | 61 ++++++ ruoyi-oa/src/main/resources/mapper/oa/SgOtherMapper.xml | 23 ++ ruoyi-oa/src/main/java/com/ruoyi/oa/domain/vo/SgOtherVo.java | 81 ++++++++ ruoyi-oa/src/main/java/com/ruoyi/oa/service/ISgOtherService.java | 56 +++++ 8 files changed, 546 insertions(+), 0 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/SgOtherController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/SgOtherController.java new file mode 100644 index 0000000..52e1adc --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/SgOtherController.java @@ -0,0 +1,118 @@ +package com.ruoyi.web.controller.oa; + +import java.util.List; +import java.util.Arrays; +import java.util.concurrent.TimeUnit; + +import com.ruoyi.common.annotation.DataDictClass; +import lombok.RequiredArgsConstructor; +import javax.servlet.http.HttpServletResponse; +import javax.validation.constraints.*; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.validation.annotation.Validated; +import com.ruoyi.common.annotation.RepeatSubmit; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.validate.AddGroup; +import com.ruoyi.common.core.validate.EditGroup; +import com.ruoyi.common.core.validate.QueryGroup; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.oa.domain.vo.SgOtherVo; +import com.ruoyi.oa.domain.bo.SgOtherBo; +import com.ruoyi.oa.service.ISgOtherService; +import com.ruoyi.common.core.page.TableDataInfo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiOperation; + +/** + * 鏂藉伐浜や粯-鍏朵粬Controller + * + * @author ruoyi + * @date 2022-10-10 + */ +@Validated +@Api(value = "鏂藉伐浜や粯-鍏朵粬鎺у埗鍣�", tags = {"鏂藉伐浜や粯-鍏朵粬绠$悊"}) +@RequiredArgsConstructor(onConstructor_ = @Autowired) +@RestController +@RequestMapping("/oa/other") +public class SgOtherController extends BaseController { + + private final ISgOtherService iSgOtherService; + + /** + * 鏌ヨ鏂藉伐浜や粯-鍏朵粬鍒楄〃 + */ + @DataDictClass + @ApiOperation("鏌ヨ鏂藉伐浜や粯-鍏朵粬鍒楄〃") +// @PreAuthorize("@ss.hasPermi('oa:other:list')") + @GetMapping("/list") + public TableDataInfo<SgOtherVo> list(@Validated(QueryGroup.class) SgOtherBo bo) { + return iSgOtherService.queryPageList(bo); + } + + /** + * 瀵煎嚭鏂藉伐浜や粯-鍏朵粬鍒楄〃 + */ + @ApiOperation("瀵煎嚭鏂藉伐浜や粯-鍏朵粬鍒楄〃") +// @PreAuthorize("@ss.hasPermi('oa:other:export')") + @Log(title = "鏂藉伐浜や粯-鍏朵粬", businessType = BusinessType.EXPORT) + @GetMapping("/export") + public void export(@Validated SgOtherBo bo, HttpServletResponse response) { + List<SgOtherVo> list = iSgOtherService.queryList(bo); + ExcelUtil.exportExcel(list, "鏂藉伐浜や粯-鍏朵粬", SgOtherVo.class, response); + } + + /** + * 鑾峰彇鏂藉伐浜や粯-鍏朵粬璇︾粏淇℃伅 + */ + @ApiOperation("鑾峰彇鏂藉伐浜や粯-鍏朵粬璇︾粏淇℃伅") +// @PreAuthorize("@ss.hasPermi('oa:other:query')") + @GetMapping("/{id}") + public AjaxResult<SgOtherVo> getInfo(@ApiParam("涓婚敭") + @NotNull(message = "涓婚敭涓嶈兘涓虹┖") + @PathVariable("id") Long id) { + return AjaxResult.success(iSgOtherService.queryById(id)); + } + + /** + * 鏂板鏂藉伐浜や粯-鍏朵粬 + */ + @ApiOperation("鏂板鏂藉伐浜や粯-鍏朵粬") +// @PreAuthorize("@ss.hasPermi('oa:other:add')") + @Log(title = "鏂藉伐浜や粯-鍏朵粬", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public AjaxResult<Void> add(@Validated(AddGroup.class) @RequestBody SgOtherBo bo) { + return toAjax(iSgOtherService.insertByBo(bo) ? 1 : 0); + } + + /** + * 淇敼鏂藉伐浜や粯-鍏朵粬 + */ + @ApiOperation("淇敼鏂藉伐浜や粯-鍏朵粬") +// @PreAuthorize("@ss.hasPermi('oa:other:edit')") + @Log(title = "鏂藉伐浜や粯-鍏朵粬", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public AjaxResult<Void> edit(@Validated(EditGroup.class) @RequestBody SgOtherBo bo) { + return toAjax(iSgOtherService.updateByBo(bo) ? 1 : 0); + } + + /** + * 鍒犻櫎鏂藉伐浜や粯-鍏朵粬 + */ + @ApiOperation("鍒犻櫎鏂藉伐浜や粯-鍏朵粬") +// @PreAuthorize("@ss.hasPermi('oa:other:remove')") + @Log(title = "鏂藉伐浜や粯-鍏朵粬" , businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult<Void> remove(@ApiParam("涓婚敭涓�") + @NotEmpty(message = "涓婚敭涓嶈兘涓虹┖") + @PathVariable Long[] ids) { + return toAjax(iSgOtherService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0); + } +} diff --git a/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/SgOther.java b/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/SgOther.java new file mode 100644 index 0000000..6055d37 --- /dev/null +++ b/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/SgOther.java @@ -0,0 +1,61 @@ +package com.ruoyi.oa.domain; + +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; +import java.io.Serializable; +import java.util.Date; +import java.math.BigDecimal; + +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 鏂藉伐浜や粯-鍏朵粬瀵硅薄 sg_other + * + * @author ruoyi + * @date 2022-10-10 + */ +@Data +@Accessors(chain = true) +@TableName("sg_other") +public class SgOther extends BaseEntity { + + private static final long serialVersionUID=1L; + + /** + * + */ + @TableId(value = "id") + private Long id; + /** + * 楂樻牎ID + */ + private Long schoolId; + /** + * 鍚嶇О + */ + private String name; + /** + * 閮ㄧ讲浣嶇疆 + */ + private Long buildingId; + /** + * 鏂藉伐鎵规 + */ + private Long constructionBatchId; + /** + * 鐢熶骇鍘傚晢 + */ + private Long manufacturerId; + /** + * 鍨嬪彿 + */ + private String model; + /** + * + */ + @TableLogic + private String delFlag; + +} diff --git a/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/bo/SgOtherBo.java b/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/bo/SgOtherBo.java new file mode 100644 index 0000000..aa72092 --- /dev/null +++ b/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/bo/SgOtherBo.java @@ -0,0 +1,101 @@ +package com.ruoyi.oa.domain.bo; + +import com.ruoyi.common.core.validate.AddGroup; +import com.ruoyi.common.core.validate.EditGroup; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import javax.validation.constraints.*; + +import java.util.Date; + +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 鏂藉伐浜や粯-鍏朵粬涓氬姟瀵硅薄 sg_other + * + * @author ruoyi + * @date 2022-10-10 + */ + +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel("鏂藉伐浜や粯-鍏朵粬涓氬姟瀵硅薄") +public class SgOtherBo extends BaseEntity { + + /** + * + */ + @ApiModelProperty(value = "", required = true) + @NotNull(message = "涓嶈兘涓虹┖", groups = { EditGroup.class }) + private Long id; + + /** + * 楂樻牎ID + */ + @ApiModelProperty(value = "楂樻牎ID", required = true) + @NotNull(message = "楂樻牎ID涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) + private Long schoolId; + + /** + * 鍚嶇О + */ + @ApiModelProperty(value = "鍚嶇О", required = true) + @NotBlank(message = "鍚嶇О涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) + private String name; + + /** + * 閮ㄧ讲浣嶇疆 + */ + @ApiModelProperty(value = "閮ㄧ讲浣嶇疆", required = true) + @NotNull(message = "閮ㄧ讲浣嶇疆涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) + private Long buildingId; + + /** + * 鏂藉伐鎵规 + */ + @ApiModelProperty(value = "鏂藉伐鎵规", required = true) + @NotNull(message = "鏂藉伐鎵规涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) + private Long constructionBatchId; + + /** + * 鐢熶骇鍘傚晢 + */ + @ApiModelProperty(value = "鐢熶骇鍘傚晢", required = true) + @NotNull(message = "鐢熶骇鍘傚晢涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) + private Long manufacturerId; + + /** + * 鍨嬪彿 + */ + @ApiModelProperty(value = "鍨嬪彿", required = true) + @NotBlank(message = "鍨嬪彿涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) + private String model; + + + /** + * 鍒嗛〉澶у皬 + */ + @ApiModelProperty("鍒嗛〉澶у皬") + private Integer pageSize; + + /** + * 褰撳墠椤垫暟 + */ + @ApiModelProperty("褰撳墠椤垫暟") + private Integer pageNum; + + /** + * 鎺掑簭鍒� + */ + @ApiModelProperty("鎺掑簭鍒�") + private String orderByColumn; + + /** + * 鎺掑簭鐨勬柟鍚慸esc鎴栬�卆sc + */ + @ApiModelProperty(value = "鎺掑簭鐨勬柟鍚�", example = "asc,desc") + private String isAsc; + +} diff --git a/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/vo/SgOtherVo.java b/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/vo/SgOtherVo.java new file mode 100644 index 0000000..7be5b04 --- /dev/null +++ b/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/vo/SgOtherVo.java @@ -0,0 +1,81 @@ +package com.ruoyi.oa.domain.vo; + +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import com.ruoyi.common.annotation.Dict; +import com.ruoyi.common.annotation.ExcelDictFormat; +import com.ruoyi.common.convert.ExcelDictConvert; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.util.Date; + + + +/** + * 鏂藉伐浜や粯-鍏朵粬瑙嗗浘瀵硅薄 sg_other + * + * @author ruoyi + * @date 2022-10-10 + */ +@Data +@ApiModel("鏂藉伐浜や粯-鍏朵粬瑙嗗浘瀵硅薄") +@ExcelIgnoreUnannotated +public class SgOtherVo { + + private static final long serialVersionUID = 1L; + + /** + * + */ + @ExcelProperty(value = "") + @ApiModelProperty("") + private Long id; + + /** + * 楂樻牎ID + */ + @ExcelProperty(value = "楂樻牎ID") + @ApiModelProperty("楂樻牎ID") + private Long schoolId; + + /** + * 鍚嶇О + */ + @ExcelProperty(value = "鍚嶇О") + @ApiModelProperty("鍚嶇О") + private String name; + + /** + * 閮ㄧ讲浣嶇疆 + */ + @ExcelProperty(value = "閮ㄧ讲浣嶇疆") + @ApiModelProperty("閮ㄧ讲浣嶇疆") + @Dict(dictTable = "bs_building", dicCode = "id", dicText = "detailed_name") + private Long buildingId; + + /** + * 鏂藉伐鎵规 + */ + @ExcelProperty(value = "鏂藉伐鎵规") + @ApiModelProperty("鏂藉伐鎵规") + @Dict(dictTable = "sg_construction_batch", dicCode = "id", dicText = "batch") + private Long constructionBatchId; + + /** + * 鐢熶骇鍘傚晢 + */ + @ExcelProperty(value = "鐢熶骇鍘傚晢") + @ApiModelProperty("鐢熶骇鍘傚晢") + @Dict(dictTable = "dev_manufacturer", dicCode = "id", dicText = "name") + private Long manufacturerId; + + /** + * 鍨嬪彿 + */ + @ExcelProperty(value = "鍨嬪彿") + @ApiModelProperty("鍨嬪彿") + private String model; + + +} diff --git a/ruoyi-oa/src/main/java/com/ruoyi/oa/mapper/SgOtherMapper.java b/ruoyi-oa/src/main/java/com/ruoyi/oa/mapper/SgOtherMapper.java new file mode 100644 index 0000000..beb7009 --- /dev/null +++ b/ruoyi-oa/src/main/java/com/ruoyi/oa/mapper/SgOtherMapper.java @@ -0,0 +1,14 @@ +package com.ruoyi.oa.mapper; + +import com.ruoyi.oa.domain.SgOther; +import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus; + +/** + * 鏂藉伐浜や粯-鍏朵粬Mapper鎺ュ彛 + * + * @author ruoyi + * @date 2022-10-10 + */ +public interface SgOtherMapper extends BaseMapperPlus<SgOther> { + +} diff --git a/ruoyi-oa/src/main/java/com/ruoyi/oa/service/ISgOtherService.java b/ruoyi-oa/src/main/java/com/ruoyi/oa/service/ISgOtherService.java new file mode 100644 index 0000000..ab85b0c --- /dev/null +++ b/ruoyi-oa/src/main/java/com/ruoyi/oa/service/ISgOtherService.java @@ -0,0 +1,56 @@ +package com.ruoyi.oa.service; + +import com.ruoyi.oa.domain.SgOther; +import com.ruoyi.oa.domain.vo.SgOtherVo; +import com.ruoyi.oa.domain.bo.SgOtherBo; +import com.ruoyi.common.core.mybatisplus.core.IServicePlus; +import com.ruoyi.common.core.page.TableDataInfo; + +import java.util.Collection; +import java.util.List; + +/** + * 鏂藉伐浜や粯-鍏朵粬Service鎺ュ彛 + * + * @author ruoyi + * @date 2022-10-10 + */ +public interface ISgOtherService extends IServicePlus<SgOther, SgOtherVo> { + /** + * 鏌ヨ鍗曚釜 + * @return + */ + SgOtherVo queryById(Long id); + + /** + * 鏌ヨ鍒楄〃 + */ + TableDataInfo<SgOtherVo> queryPageList(SgOtherBo bo); + + /** + * 鏌ヨ鍒楄〃 + */ + List<SgOtherVo> queryList(SgOtherBo bo); + + /** + * 鏍规嵁鏂板涓氬姟瀵硅薄鎻掑叆鏂藉伐浜や粯-鍏朵粬 + * @param bo 鏂藉伐浜や粯-鍏朵粬鏂板涓氬姟瀵硅薄 + * @return + */ + Boolean insertByBo(SgOtherBo bo); + + /** + * 鏍规嵁缂栬緫涓氬姟瀵硅薄淇敼鏂藉伐浜や粯-鍏朵粬 + * @param bo 鏂藉伐浜や粯-鍏朵粬缂栬緫涓氬姟瀵硅薄 + * @return + */ + Boolean updateByBo(SgOtherBo bo); + + /** + * 鏍¢獙骞跺垹闄ゆ暟鎹� + * @param ids 涓婚敭闆嗗悎 + * @param isValid 鏄惁鏍¢獙,true-鍒犻櫎鍓嶆牎楠�,false-涓嶆牎楠� + * @return + */ + Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); +} diff --git a/ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/SgOtherServiceImpl.java b/ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/SgOtherServiceImpl.java new file mode 100644 index 0000000..a464139 --- /dev/null +++ b/ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/SgOtherServiceImpl.java @@ -0,0 +1,92 @@ +package com.ruoyi.oa.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.common.core.page.PagePlus; +import com.ruoyi.common.core.page.TableDataInfo; +import org.springframework.stereotype.Service; +import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ruoyi.oa.domain.bo.SgOtherBo; +import com.ruoyi.oa.domain.vo.SgOtherVo; +import com.ruoyi.oa.domain.SgOther; +import com.ruoyi.oa.mapper.SgOtherMapper; +import com.ruoyi.oa.service.ISgOtherService; + +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 鏂藉伐浜や粯-鍏朵粬Service涓氬姟灞傚鐞� + * + * @author ruoyi + * @date 2022-10-10 + */ +@Service +public class SgOtherServiceImpl extends ServicePlusImpl<SgOtherMapper, SgOther, SgOtherVo> implements ISgOtherService { + + @Override + public SgOtherVo queryById(Long id){ + return getVoById(id); + } + + @Override + public TableDataInfo<SgOtherVo> queryPageList(SgOtherBo bo) { + PagePlus<SgOther, SgOtherVo> result = pageVo(PageUtils.buildPagePlus(), buildQueryWrapper(bo)); + return PageUtils.buildDataInfo(result); + } + + @Override + public List<SgOtherVo> queryList(SgOtherBo bo) { + return listVo(buildQueryWrapper(bo)); + } + + private LambdaQueryWrapper<SgOther> buildQueryWrapper(SgOtherBo bo) { + Map<String, Object> params = bo.getParams(); + LambdaQueryWrapper<SgOther> lqw = Wrappers.lambdaQuery(); + lqw.like(StringUtils.isNotBlank(bo.getName()), SgOther::getName, bo.getName()); + lqw.eq(bo.getBuildingId() != null, SgOther::getBuildingId, bo.getBuildingId()); + lqw.eq(bo.getConstructionBatchId() != null, SgOther::getConstructionBatchId, bo.getConstructionBatchId()); + lqw.eq(bo.getManufacturerId() != null, SgOther::getManufacturerId, bo.getManufacturerId()); + lqw.eq(bo.getSchoolId() != null, SgOther::getSchoolId, bo.getSchoolId()); + return lqw; + } + + @Override + public Boolean insertByBo(SgOtherBo bo) { + SgOther add = BeanUtil.toBean(bo, SgOther.class); + validEntityBeforeSave(add); + boolean flag = save(add); + if (flag) { + bo.setId(add.getId()); + } + return flag; + } + + @Override + public Boolean updateByBo(SgOtherBo bo) { + SgOther update = BeanUtil.toBean(bo, SgOther.class); + validEntityBeforeSave(update); + return updateById(update); + } + + /** + * 淇濆瓨鍓嶇殑鏁版嵁鏍¢獙 + * + * @param entity 瀹炰綋绫绘暟鎹� + */ + private void validEntityBeforeSave(SgOther entity){ + //TODO 鍋氫竴浜涙暟鎹牎楠�,濡傚敮涓�绾︽潫 + } + + @Override + public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { + if(isValid){ + //TODO 鍋氫竴浜涗笟鍔′笂鐨勬牎楠�,鍒ゆ柇鏄惁闇�瑕佹牎楠� + } + return removeByIds(ids); + } +} diff --git a/ruoyi-oa/src/main/resources/mapper/oa/SgOtherMapper.xml b/ruoyi-oa/src/main/resources/mapper/oa/SgOtherMapper.xml new file mode 100644 index 0000000..c7bcb82 --- /dev/null +++ b/ruoyi-oa/src/main/resources/mapper/oa/SgOtherMapper.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper +PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" +"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.ruoyi.oa.mapper.SgOtherMapper"> + + <resultMap type="com.ruoyi.oa.domain.SgOther" id="SgOtherResult"> + <result property="id" column="id"/> + <result property="schoolId" column="school_id"/> + <result property="name" column="name"/> + <result property="buildingId" column="building_id"/> + <result property="constructionBatchId" column="construction_batch_id"/> + <result property="manufacturerId" column="manufacturer_id"/> + <result property="model" column="model"/> + <result property="createBy" column="create_by"/> + <result property="createTime" column="create_time"/> + <result property="updateBy" column="update_by"/> + <result property="updateTime" column="update_time"/> + <result property="delFlag" column="del_flag"/> + </resultMap> + + +</mapper> -- Gitblit v1.9.1