修改了部分数据结构
commit
23afe6f58b
|
@ -1,6 +1,8 @@
|
||||||
package com.ruoyi.sip.controller;
|
package com.ruoyi.sip.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ruoyi.sip.domain.OrderList;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
@ -113,7 +115,6 @@ public class OrderInfoController extends BaseController
|
||||||
{
|
{
|
||||||
return toAjax(orderInfoService.updateOrderInfo(orderInfo));
|
return toAjax(orderInfoService.updateOrderInfo(orderInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除合同档案
|
* 删除合同档案
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -41,6 +41,8 @@ public class OrderList extends BaseEntity
|
||||||
@Excel(name = "总价")
|
@Excel(name = "总价")
|
||||||
private BigDecimal amount;
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
|
||||||
|
private String operateFlag;
|
||||||
/** 创建时间 */
|
/** 创建时间 */
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||||
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
|
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
@ -138,6 +140,14 @@ public class OrderList extends BaseEntity
|
||||||
return deletedAt;
|
return deletedAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getOperateFlag() {
|
||||||
|
return operateFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOperateFlag(String operateFlag) {
|
||||||
|
this.operateFlag = operateFlag;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
|
|
@ -84,4 +84,17 @@ public interface OrderInfoMapper
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteOrderListByOrderId(Long id);
|
public int deleteOrderListByOrderId(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除合同清单
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int logicRemoveListById(List<OrderList> orderListList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新合同清单
|
||||||
|
* @param orderListList
|
||||||
|
*/
|
||||||
|
void updateListBatch(List<OrderList> orderListList);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.ruoyi.sip.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.ruoyi.sip.domain.OrderInfo;
|
import com.ruoyi.sip.domain.OrderInfo;
|
||||||
|
import com.ruoyi.sip.domain.OrderList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 合同档案Service接口
|
* 合同档案Service接口
|
||||||
|
|
|
@ -4,6 +4,9 @@ import java.util.List;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import com.ruoyi.sip.domain.OrderList;
|
import com.ruoyi.sip.domain.OrderList;
|
||||||
|
@ -73,8 +76,26 @@ public class OrderInfoServiceImpl implements IOrderInfoService
|
||||||
@Override
|
@Override
|
||||||
public int updateOrderInfo(OrderInfo orderInfo)
|
public int updateOrderInfo(OrderInfo orderInfo)
|
||||||
{
|
{
|
||||||
orderInfoMapper.deleteOrderListByOrderId(orderInfo.getId());
|
List<OrderList> orderListList = orderInfo.getOrderListList();
|
||||||
insertOrderList(orderInfo);
|
Map<String, List<OrderList>> operateMap =
|
||||||
|
orderListList.stream().collect(Collectors.groupingBy(OrderList::getOperateFlag));
|
||||||
|
//新增
|
||||||
|
List<OrderList> addList = operateMap.get("0");
|
||||||
|
if (addList!=null && !addList.isEmpty()){
|
||||||
|
orderInfoMapper.batchOrderList(addList);
|
||||||
|
}
|
||||||
|
//更新
|
||||||
|
List<OrderList> updateList = operateMap.get("1");
|
||||||
|
if (updateList!=null && !updateList.isEmpty()){
|
||||||
|
|
||||||
|
orderInfoMapper.updateListBatch(updateList);
|
||||||
|
}
|
||||||
|
//删除
|
||||||
|
List<OrderList> deleteList = operateMap.get("2");
|
||||||
|
if (deleteList!=null && !deleteList.isEmpty()){
|
||||||
|
|
||||||
|
orderInfoMapper.logicRemoveListById(deleteList);
|
||||||
|
}
|
||||||
return orderInfoMapper.updateOrderInfo(orderInfo);
|
return orderInfoMapper.updateOrderInfo(orderInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,62 +1,101 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.ruoyi.sip.mapper.OrderInfoMapper">
|
<mapper namespace="com.ruoyi.sip.mapper.OrderInfoMapper">
|
||||||
|
|
||||||
<resultMap type="OrderInfo" id="OrderInfoResult">
|
<resultMap type="OrderInfo" id="OrderInfoResult">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id"/>
|
||||||
<result property="projectCode" column="project_code" />
|
<result property="projectCode" column="project_code"/>
|
||||||
<result property="orderCode" column="order_code" />
|
<result property="orderCode" column="order_code"/>
|
||||||
<result property="versionCode" column="version_code" />
|
<result property="versionCode" column="version_code"/>
|
||||||
<result property="orderName" column="order_name" />
|
<result property="orderName" column="order_name"/>
|
||||||
<result property="customerName" column="customer_name" />
|
<result property="customerName" column="customer_name"/>
|
||||||
<result property="customerContact" column="customer_contact" />
|
<result property="customerContact" column="customer_contact"/>
|
||||||
<result property="customerPhone" column="customer_phone" />
|
<result property="customerPhone" column="customer_phone"/>
|
||||||
<result property="customerEmail" column="customer_email" />
|
<result property="customerEmail" column="customer_email"/>
|
||||||
<result property="orderType" column="order_type" />
|
<result property="orderType" column="order_type"/>
|
||||||
<result property="orderDept" column="order_dept" />
|
<result property="orderDept" column="order_dept"/>
|
||||||
<result property="partenerDept" column="partener_dept" />
|
<result property="partenerDept" column="partener_dept"/>
|
||||||
<result property="orderDate" column="order_date" />
|
<result property="orderDate" column="order_date"/>
|
||||||
<result property="status" column="status" />
|
<result property="status" column="status"/>
|
||||||
<result property="remark" column="remark" />
|
<result property="remark" column="remark"/>
|
||||||
<result property="createdAt" column="created_at" />
|
<result property="createdAt" column="created_at"/>
|
||||||
<result property="updatedAt" column="updated_at" />
|
<result property="updatedAt" column="updated_at"/>
|
||||||
<result property="deletedAt" column="deleted_at" />
|
<result property="deletedAt" column="deleted_at"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap id="OrderInfoOrderListResult" type="OrderInfo" extends="OrderInfoResult">
|
<resultMap id="OrderInfoOrderListResult" type="OrderInfo" extends="OrderInfoResult">
|
||||||
<collection property="orderListList" ofType="OrderList" column="id" select="selectOrderListList" />
|
<collection property="orderListList" ofType="OrderList" column="id" select="selectOrderListList"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap type="OrderList" id="OrderListResult">
|
<resultMap type="OrderList" id="OrderListResult">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id"/>
|
||||||
<result property="orderId" column="order_id" />
|
<result property="orderId" column="order_id"/>
|
||||||
<result property="productCode" column="product_code" />
|
<result property="productCode" column="product_code"/>
|
||||||
<result property="quantity" column="quantity" />
|
<result property="quantity" column="quantity"/>
|
||||||
<result property="price" column="price" />
|
<result property="price" column="price"/>
|
||||||
<result property="amount" column="amount" />
|
<result property="amount" column="amount"/>
|
||||||
<result property="remark" column="remark" />
|
<result property="remark" column="remark"/>
|
||||||
<result property="createdAt" column="created_at" />
|
<result property="createdAt" column="created_at"/>
|
||||||
|
<result property="updatedAt" column="updated_at"/>
|
||||||
|
<result property="deletedAt" column="deleted_at"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectOrderInfoVo">
|
<sql id="selectOrderInfoVo">
|
||||||
select id, project_code, order_code, version_code, order_name, customer_name, customer_contact, customer_phone, customer_email, order_type, order_dept, partener_dept, order_date, status, remark, created_at, updated_at, deleted_at from order_info
|
select id,
|
||||||
|
project_code,
|
||||||
|
order_code,
|
||||||
|
version_code,
|
||||||
|
order_name,
|
||||||
|
customer_name,
|
||||||
|
customer_contact,
|
||||||
|
customer_phone,
|
||||||
|
customer_email,
|
||||||
|
order_type,
|
||||||
|
order_dept,
|
||||||
|
partener_dept,
|
||||||
|
order_date,
|
||||||
|
status,
|
||||||
|
remark,
|
||||||
|
created_at,
|
||||||
|
updated_at,
|
||||||
|
deleted_at
|
||||||
|
from order_info
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectOrderInfoList" parameterType="OrderInfo" resultMap="OrderInfoResult">
|
<select id="selectOrderInfoList" parameterType="OrderInfo" resultMap="OrderInfoResult">
|
||||||
<include refid="selectOrderInfoVo"/>
|
<include refid="selectOrderInfoVo"/>
|
||||||
<where>
|
<where>
|
||||||
and status=0
|
and status=0
|
||||||
<if test="orderCode != null and orderCode != ''"> and order_code like concat('%', #{orderCode}, '%')</if>
|
<if test="orderCode != null and orderCode != ''">and order_code like concat('%', #{orderCode}, '%')</if>
|
||||||
<if test="orderName != null and orderName != ''"> and order_name like concat('%', #{orderName}, '%')</if>
|
<if test="orderName != null and orderName != ''">and order_name like concat('%', #{orderName}, '%')</if>
|
||||||
<if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
|
<if test="customerName != null and customerName != ''">and customer_name like concat('%', #{customerName},
|
||||||
<if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
|
'%')
|
||||||
|
</if>
|
||||||
|
<if test="orderType != null and orderType != ''">and order_type = #{orderType}</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectOrderInfoById" parameterType="Long" resultMap="OrderInfoOrderListResult">
|
<select id="selectOrderInfoById" parameterType="Long" resultMap="OrderInfoOrderListResult">
|
||||||
select id, project_code, order_code, version_code, order_name, customer_name, customer_contact, customer_phone, customer_email, order_type, order_dept, partener_dept, order_date, status, remark, created_at, updated_at, deleted_at
|
select id,
|
||||||
|
project_code,
|
||||||
|
order_code,
|
||||||
|
version_code,
|
||||||
|
order_name,
|
||||||
|
customer_name,
|
||||||
|
customer_contact,
|
||||||
|
customer_phone,
|
||||||
|
customer_email,
|
||||||
|
order_type,
|
||||||
|
order_dept,
|
||||||
|
partener_dept,
|
||||||
|
order_date,
|
||||||
|
status,
|
||||||
|
remark,
|
||||||
|
created_at,
|
||||||
|
updated_at,
|
||||||
|
deleted_at
|
||||||
from order_info
|
from order_info
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
@ -85,7 +124,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="status != null">status,</if>
|
<if test="status != null">status,</if>
|
||||||
<if test="remark != null">remark,</if>
|
<if test="remark != null">remark,</if>
|
||||||
created_at,status,
|
created_at,status,
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="projectCode != null">#{projectCode},</if>
|
<if test="projectCode != null">#{projectCode},</if>
|
||||||
<if test="orderCode != null and orderCode != ''">#{orderCode},</if>
|
<if test="orderCode != null and orderCode != ''">#{orderCode},</if>
|
||||||
|
@ -102,7 +141,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="status != null">#{status},</if>
|
<if test="status != null">#{status},</if>
|
||||||
<if test="remark != null">#{remark},</if>
|
<if test="remark != null">#{remark},</if>
|
||||||
NOW(),0
|
NOW(),0
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="updateOrderInfo" parameterType="OrderInfo">
|
<update id="updateOrderInfo" parameterType="OrderInfo">
|
||||||
|
@ -126,9 +165,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
<update id="logicRemoveListById">
|
||||||
|
update order_list set deleted_at=NOW(), status=1 where id in
|
||||||
|
<foreach item="item" index="index" collection="list" open="(" close=")" separator=",">
|
||||||
|
#{item.id}
|
||||||
|
</foreach>
|
||||||
|
|
||||||
|
</update>
|
||||||
|
<update id="updateListBatch">
|
||||||
|
<foreach item="item" index="index" collection="list" separator=";">
|
||||||
|
update order_list
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="productId != null">product_id = #{productId},</if>
|
||||||
|
<if test="quantity != null ">quantity = #{quantity},</if>
|
||||||
|
<if test="price != null">price = #{price},</if>
|
||||||
|
<if test="amount != null">amount = #{amount},</if>
|
||||||
|
|
||||||
|
<if test="remark != null and remark!=''">remark = #{remark},</if>
|
||||||
|
updated_at = NOW(),
|
||||||
|
</trim>
|
||||||
|
where id = #{item.id}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
|
|
||||||
<delete id="deleteOrderInfoById" parameterType="Long">
|
<delete id="deleteOrderInfoById" parameterType="Long">
|
||||||
update order_info set deleted_at=NOW(), status=1 where id = #{id}
|
update order_info
|
||||||
|
set deleted_at=NOW(),
|
||||||
|
status=1
|
||||||
|
where id = #{id}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteOrderInfoByIds" parameterType="String">
|
<delete id="deleteOrderInfoByIds" parameterType="String">
|
||||||
|
@ -137,16 +201,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteOrderListByOrderIds" parameterType="String">
|
<delete id="deleteOrderListByOrderIds" parameterType="String">
|
||||||
delete from order_list where order_id in
|
delete from order_list where order_id in
|
||||||
<foreach item="orderId" collection="array" open="(" separator="," close=")">
|
<foreach item="orderId" collection="array" open="(" separator="," close=")">
|
||||||
#{orderId}
|
#{orderId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteOrderListByOrderId" parameterType="Long">
|
<delete id="deleteOrderListByOrderId" parameterType="Long">
|
||||||
delete from order_list where order_id = #{orderId}
|
delete
|
||||||
|
from order_list
|
||||||
|
where order_id = #{orderId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<insert id="batchOrderList">
|
<insert id="batchOrderList">
|
||||||
|
|
Loading…
Reference in New Issue