init
This commit is contained in:
+44
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.zhaocai;
|
||||
|
||||
import org.springblade.core.cloud.client.BladeCloudApplication;
|
||||
import org.springblade.core.launch.BladeApplication;
|
||||
import org.springblade.core.launch.constant.AppConstant;
|
||||
|
||||
/**
|
||||
* 招采服务启动器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@BladeCloudApplication
|
||||
public class ZhaocaiApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
BladeApplication.run(AppConstant.APPLICATION_NAME_PREFIX + "zhaocai", ZhaocaiApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.zhaocai.config;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
|
||||
/**
|
||||
* 配置 feign、mybatis 包名
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ComponentScan({"org.springblade"})
|
||||
@EnableFeignClients({"org.springblade"})
|
||||
@MapperScan({"org.springblade.**.mapper.**"})
|
||||
public class ZhaocaiConfiguration {
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory connectionFactory) {
|
||||
RedisTemplate<String, Object> template = new RedisTemplate<>();
|
||||
template.setConnectionFactory(connectionFactory);
|
||||
template.setKeySerializer(new StringRedisSerializer());
|
||||
template.setHashKeySerializer(new StringRedisSerializer());
|
||||
template.setValueSerializer(new GenericJackson2JsonRedisSerializer());
|
||||
template.setHashValueSerializer(new GenericJackson2JsonRedisSerializer());
|
||||
return template;
|
||||
}
|
||||
|
||||
}
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.zhaocai.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.zhaocai.pojo.entity.ProcurementPlan;
|
||||
import org.springblade.zhaocai.pojo.vo.ProcurementPlanVO;
|
||||
import org.springblade.zhaocai.service.IProcurementPlanService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 招采计划控制器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("procurement-plan")
|
||||
@AllArgsConstructor
|
||||
@Tag(name = "招采计划", description = "招采计划接口")
|
||||
public class ProcurementPlanController extends BladeController {
|
||||
|
||||
private final IProcurementPlanService procurementPlanService;
|
||||
|
||||
/**
|
||||
* 详情(含明细)
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "详情", description = "传入id")
|
||||
public R<ProcurementPlanVO> detail(@Parameter(name = "id", description = "主键", in = ParameterIn.QUERY, schema = @Schema(type = "integer")) @RequestParam Long id) {
|
||||
ProcurementPlanVO detail = procurementPlanService.detail(id);
|
||||
return R.data(detail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@Parameters({
|
||||
@Parameter(name = "applicant", description = "申请人", in = ParameterIn.QUERY, schema = @Schema(type = "string")),
|
||||
@Parameter(name = "billNo", description = "单据号", in = ParameterIn.QUERY, schema = @Schema(type = "string")),
|
||||
@Parameter(name = "year", description = "年度", in = ParameterIn.QUERY, schema = @Schema(type = "string"))
|
||||
})
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "分页", description = "传入procurementPlan")
|
||||
public R<IPage<ProcurementPlan>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> procurementPlan, Query query) {
|
||||
IPage<ProcurementPlan> pages = procurementPlanService.page(Condition.getPage(query), Condition.getQueryWrapper(procurementPlan, ProcurementPlan.class));
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "新增", description = "传入procurementPlan")
|
||||
public R save(@RequestBody ProcurementPlanVO procurementPlanVO) {
|
||||
return R.status(procurementPlanService.submit(procurementPlanVO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "修改", description = "传入procurementPlan")
|
||||
public R update(@RequestBody ProcurementPlanVO procurementPlanVO) {
|
||||
return R.status(procurementPlanService.submit(procurementPlanVO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增或修改
|
||||
*/
|
||||
@PostMapping("/submit")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "新增或修改", description = "传入procurementPlan")
|
||||
public R submit(@RequestBody ProcurementPlanVO procurementPlanVO) {
|
||||
return R.status(procurementPlanService.submit(procurementPlanVO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@PostMapping("/remove")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "逻辑删除", description = "传入ids")
|
||||
public R remove(@Parameter(name = "ids", description = "主键集合", in = ParameterIn.QUERY, schema = @Schema(type = "string")) @RequestParam String ids) {
|
||||
boolean temp = procurementPlanService.deleteLogic(Func.toLongList(ids));
|
||||
return R.status(temp);
|
||||
}
|
||||
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.zhaocai.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springblade.zhaocai.pojo.entity.ProcurementPlanDetail;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 招采计划明细 Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface ProcurementPlanDetailMapper extends BaseMapper<ProcurementPlanDetail> {
|
||||
|
||||
/**
|
||||
* 根据主表ID查询明细列表
|
||||
*
|
||||
* @param planId 主表ID
|
||||
* @return 明细列表
|
||||
*/
|
||||
List<ProcurementPlanDetail> selectByPlanId(Long planId);
|
||||
|
||||
/**
|
||||
* 根据主表ID删除明细
|
||||
*
|
||||
* @param planId 主表ID
|
||||
* @return 影响行数
|
||||
*/
|
||||
int deleteByPlanId(Long planId);
|
||||
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
<?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="org.springblade.zhaocai.mapper.ProcurementPlanDetailMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="procurementPlanDetailResultMap" type="org.springblade.zhaocai.pojo.entity.ProcurementPlanDetail">
|
||||
<result column="id" property="id"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
<result column="create_user" property="createUser"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
<result column="plan_id" property="planId"/>
|
||||
<result column="year" property="year"/>
|
||||
<result column="plan" property="plan"/>
|
||||
<result column="plan_type" property="planType"/>
|
||||
<result column="sort_no" property="sortNo"/>
|
||||
<result column="project_name" property="projectName"/>
|
||||
<result column="project_type" property="projectType"/>
|
||||
<result column="contact_person" property="contactPerson"/>
|
||||
<result column="apply_date" property="applyDate"/>
|
||||
<result column="expect_date" property="expectDate"/>
|
||||
<result column="project_attr" property="projectAttr"/>
|
||||
<result column="material_detail" property="materialDetail"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="baseColumnList">
|
||||
select
|
||||
id, tenant_id, create_user, create_time, update_user, update_time, status, is_deleted,
|
||||
plan_id, year, plan, plan_type, sort_no, project_name, project_type, contact_person,
|
||||
apply_date, expect_date, project_attr, material_detail
|
||||
</sql>
|
||||
|
||||
<select id="selectByPlanId" resultMap="procurementPlanDetailResultMap">
|
||||
<include refid="baseColumnList"/>
|
||||
from blade_procurement_plan_detail
|
||||
where plan_id = #{planId}
|
||||
and is_deleted = 0
|
||||
order by sort_no asc
|
||||
</select>
|
||||
|
||||
<delete id="deleteByPlanId">
|
||||
delete from blade_procurement_plan_detail where plan_id = #{planId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.zhaocai.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.zhaocai.pojo.entity.ProcurementPlan;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 招采计划 Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface ProcurementPlanMapper extends BaseMapper<ProcurementPlan> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page
|
||||
* @param procurementPlan
|
||||
* @return
|
||||
*/
|
||||
List<ProcurementPlan> selectProcurementPlanPage(IPage page, ProcurementPlan procurementPlan);
|
||||
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
<?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="org.springblade.zhaocai.mapper.ProcurementPlanMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="procurementPlanResultMap" type="org.springblade.zhaocai.pojo.entity.ProcurementPlan">
|
||||
<result column="id" property="id"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
<result column="create_user" property="createUser"/>
|
||||
<result column="create_dept" property="createDept"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
<result column="applicant" property="applicant"/>
|
||||
<result column="apply_time" property="applyTime"/>
|
||||
<result column="phone" property="phone"/>
|
||||
<result column="company" property="company"/>
|
||||
<result column="bill_no" property="billNo"/>
|
||||
<result column="year" property="year"/>
|
||||
<result column="dept" property="dept"/>
|
||||
<result column="apply_company" property="applyCompany"/>
|
||||
<result column="estimated_amount" property="estimatedAmount"/>
|
||||
<result column="amount_upper" property="amountUpper"/>
|
||||
<result column="remark" property="remark"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="baseColumnList">
|
||||
select
|
||||
id, tenant_id, create_user, create_dept, create_time, update_user, update_time, status, is_deleted,
|
||||
applicant, apply_time, phone, company, bill_no, year, dept, apply_company, estimated_amount, amount_upper, remark
|
||||
</sql>
|
||||
|
||||
<select id="selectProcurementPlanPage" resultMap="procurementPlanResultMap">
|
||||
<include refid="baseColumnList"/>
|
||||
from blade_procurement_plan
|
||||
where is_deleted = 0
|
||||
<if test="procurementPlan.applicant != null and procurementPlan.applicant != ''">
|
||||
and applicant like concat('%', #{procurementPlan.applicant}, '%')
|
||||
</if>
|
||||
<if test="procurementPlan.billNo != null and procurementPlan.billNo != ''">
|
||||
and bill_no like concat('%', #{procurementPlan.billNo}, '%')
|
||||
</if>
|
||||
<if test="procurementPlan.year != null and procurementPlan.year != ''">
|
||||
and year = #{procurementPlan.year}
|
||||
</if>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.zhaocai.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.springblade.zhaocai.pojo.entity.ProcurementPlanDetail;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 招采计划明细服务类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface IProcurementPlanDetailService extends IService<ProcurementPlanDetail> {
|
||||
|
||||
/**
|
||||
* 根据主表ID查询明细列表
|
||||
*
|
||||
* @param planId 主表ID
|
||||
* @return 明细列表
|
||||
*/
|
||||
List<ProcurementPlanDetail> listByPlanId(Long planId);
|
||||
|
||||
/**
|
||||
* 根据主表ID删除明细
|
||||
*
|
||||
* @param planId 主表ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean removeByPlanId(Long planId);
|
||||
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.zhaocai.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
import org.springblade.zhaocai.pojo.entity.ProcurementPlan;
|
||||
import org.springblade.zhaocai.pojo.vo.ProcurementPlanVO;
|
||||
|
||||
/**
|
||||
* 招采计划服务类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface IProcurementPlanService extends BaseService<ProcurementPlan> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page
|
||||
* @param procurementPlan
|
||||
* @return
|
||||
*/
|
||||
IPage<ProcurementPlan> selectProcurementPlanPage(IPage<ProcurementPlan> page, ProcurementPlan procurementPlan);
|
||||
|
||||
/**
|
||||
* 详情(含明细)
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 招采计划VO
|
||||
*/
|
||||
ProcurementPlanVO detail(Long id);
|
||||
|
||||
/**
|
||||
* 提交(新增或修改,含明细)
|
||||
*
|
||||
* @param procurementPlanVO 招采计划VO
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean submit(ProcurementPlanVO procurementPlanVO);
|
||||
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.zhaocai.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springblade.zhaocai.mapper.ProcurementPlanDetailMapper;
|
||||
import org.springblade.zhaocai.pojo.entity.ProcurementPlanDetail;
|
||||
import org.springblade.zhaocai.service.IProcurementPlanDetailService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 招采计划明细服务实现类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Service
|
||||
public class ProcurementPlanDetailServiceImpl extends ServiceImpl<ProcurementPlanDetailMapper, ProcurementPlanDetail> implements IProcurementPlanDetailService {
|
||||
|
||||
@Override
|
||||
public List<ProcurementPlanDetail> listByPlanId(Long planId) {
|
||||
return baseMapper.selectList(Wrappers.<ProcurementPlanDetail>lambdaQuery()
|
||||
.eq(ProcurementPlanDetail::getPlanId, planId)
|
||||
.orderByAsc(ProcurementPlanDetail::getSortNo));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeByPlanId(Long planId) {
|
||||
return baseMapper.delete(Wrappers.<ProcurementPlanDetail>lambdaQuery()
|
||||
.eq(ProcurementPlanDetail::getPlanId, planId)) > 0;
|
||||
}
|
||||
|
||||
}
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.zhaocai.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.zhaocai.mapper.ProcurementPlanMapper;
|
||||
import org.springblade.zhaocai.pojo.entity.ProcurementPlan;
|
||||
import org.springblade.zhaocai.pojo.entity.ProcurementPlanDetail;
|
||||
import org.springblade.zhaocai.pojo.vo.ProcurementPlanDetailVO;
|
||||
import org.springblade.zhaocai.pojo.vo.ProcurementPlanVO;
|
||||
import org.springblade.zhaocai.service.IProcurementPlanDetailService;
|
||||
import org.springblade.zhaocai.service.IProcurementPlanService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 招采计划服务实现类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class ProcurementPlanServiceImpl extends BaseServiceImpl<ProcurementPlanMapper, ProcurementPlan> implements IProcurementPlanService {
|
||||
|
||||
private final IProcurementPlanDetailService procurementPlanDetailService;
|
||||
|
||||
@Override
|
||||
public IPage<ProcurementPlan> selectProcurementPlanPage(IPage<ProcurementPlan> page, ProcurementPlan procurementPlan) {
|
||||
return page.setRecords(baseMapper.selectProcurementPlanPage(page, procurementPlan));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcurementPlanVO detail(Long id) {
|
||||
ProcurementPlanVO vo = new ProcurementPlanVO();
|
||||
ProcurementPlan plan = baseMapper.selectById(id);
|
||||
if (plan == null) {
|
||||
return vo;
|
||||
}
|
||||
Func.copy(plan, vo);
|
||||
List<ProcurementPlanDetail> detailList = procurementPlanDetailService.listByPlanId(id);
|
||||
vo.setDetailList(detailList.stream().map(detail -> {
|
||||
ProcurementPlanDetailVO detailVO = new ProcurementPlanDetailVO();
|
||||
Func.copy(detail, detailVO);
|
||||
return detailVO;
|
||||
}).toList());
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean submit(ProcurementPlanVO procurementPlanVO) {
|
||||
// 保存主表
|
||||
boolean result = saveOrUpdate(procurementPlanVO);
|
||||
Long planId = procurementPlanVO.getId();
|
||||
// 删除旧明细
|
||||
procurementPlanDetailService.removeByPlanId(planId);
|
||||
// 保存新明细
|
||||
List<ProcurementPlanDetailVO> detailVOList = procurementPlanVO.getDetailList();
|
||||
if (Func.isNotEmpty(detailVOList)) {
|
||||
List<ProcurementPlanDetail> detailList = detailVOList.stream().map(detailVO -> {
|
||||
ProcurementPlanDetail detail = new ProcurementPlanDetail();
|
||||
Func.copy(detailVO, detail);
|
||||
detail.setPlanId(planId);
|
||||
return detail;
|
||||
}).toList();
|
||||
for (int i = 0; i < detailList.size(); i++) {
|
||||
detailList.get(i).setSortNo(i + 1);
|
||||
}
|
||||
procurementPlanDetailService.saveBatch(detailList);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.zhaocai.wrapper;
|
||||
|
||||
import org.springblade.core.mp.support.BaseEntityWrapper;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.zhaocai.pojo.entity.ProcurementPlan;
|
||||
import org.springblade.zhaocai.pojo.vo.ProcurementPlanVO;
|
||||
|
||||
/**
|
||||
* 招采计划包装类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public class ProcurementPlanWrapper extends BaseEntityWrapper<ProcurementPlan, ProcurementPlanVO> {
|
||||
|
||||
public static ProcurementPlanWrapper build() {
|
||||
return new ProcurementPlanWrapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcurementPlanVO entityVO(ProcurementPlan procurementPlan) {
|
||||
ProcurementPlanVO procurementPlanVO = BeanUtil.copy(procurementPlan, ProcurementPlanVO.class);
|
||||
return procurementPlanVO;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
#服务器端口
|
||||
server:
|
||||
port: 8210
|
||||
|
||||
#Spring配置
|
||||
spring:
|
||||
datasource:
|
||||
#主数据源信息
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://172.16.92.89:3306/bladex_zhaocai?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
|
||||
username: root
|
||||
password: Aa123456
|
||||
#动态数据源信息
|
||||
dynamic:
|
||||
druid:
|
||||
#通用校验配置
|
||||
validation-query: select 1
|
||||
#设置默认的数据源或者数据源组,默认值即为master
|
||||
primary: master
|
||||
datasource:
|
||||
slave:
|
||||
druid:
|
||||
#独立校验配置
|
||||
validation-query: select 1
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://172.16.92.89:3306/bladex_zhaocai?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
|
||||
username: root
|
||||
password: Aa123456
|
||||
@@ -0,0 +1,12 @@
|
||||
#服务器端口
|
||||
server:
|
||||
port: 8210
|
||||
|
||||
#Spring配置
|
||||
spring:
|
||||
datasource:
|
||||
#主数据源信息
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: ${blade.datasource.zhaocai.master.url}
|
||||
username: ${blade.datasource.zhaocai.master.username}
|
||||
password: ${blade.datasource.zhaocai.master.password}
|
||||
@@ -0,0 +1,12 @@
|
||||
#服务器端口
|
||||
server:
|
||||
port: 8210
|
||||
|
||||
#Spring配置
|
||||
spring:
|
||||
datasource:
|
||||
#主数据源信息
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: ${blade.datasource.zhaocai.master.url}
|
||||
username: ${blade.datasource.zhaocai.master.username}
|
||||
password: ${blade.datasource.zhaocai.master.password}
|
||||
@@ -0,0 +1,10 @@
|
||||
#mybatis-plus配置
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath:org/springblade/**/mapper/*Mapper.xml
|
||||
#实体扫描,多个package用逗号或者分号分隔
|
||||
typeAliasesPackage: org.springblade.**.entity
|
||||
|
||||
#swagger扫描路径配置
|
||||
swagger:
|
||||
base-packages:
|
||||
- org.springblade
|
||||
Reference in New Issue
Block a user