订单、装备数据隔离
This commit is contained in:
parent
3851cfc92b
commit
70df292288
|
|
@ -93,7 +93,7 @@ public class OrderController extends BaseController {
|
|||
// 编码设备已退租的先下架
|
||||
dto.setMaStatus("1");
|
||||
orderMapper.updateDeviceStatus(dto);
|
||||
/* } else {
|
||||
/* } else {
|
||||
// 数量设备已退租的增加库存
|
||||
orderMapper.updateAddDevCount(dto);
|
||||
}*/
|
||||
|
|
|
|||
|
|
@ -61,7 +61,11 @@ public class OrderInfoDto {
|
|||
private String address;
|
||||
|
||||
@ApiModelProperty(value = "买方承租方用户id")
|
||||
private String buyerId;
|
||||
private Integer buyerId;
|
||||
@ApiModelProperty(value = "买方承租方公司id")
|
||||
private Integer buyerCompany;
|
||||
@ApiModelProperty(value = "卖方出租方公司id")
|
||||
private Integer sellerCompany;
|
||||
|
||||
@ApiModelProperty(value = "卖方出租方用户id")
|
||||
private String sellerId;
|
||||
|
|
|
|||
|
|
@ -64,7 +64,8 @@ public class OrderServiceImpl implements OrderService {
|
|||
String code = "D" + System.currentTimeMillis();
|
||||
orderInfoDto.setCode(code);
|
||||
Long userid = SecurityUtils.getLoginUser().getUserid();
|
||||
orderInfoDto.setBuyerId(userid.toString());
|
||||
orderInfoDto.setBuyerId(userid.intValue());
|
||||
orderInfoDto.setBuyerCompany(SecurityUtils.getLoginUser().getSysUser().getCompanyId().intValue());
|
||||
orderInfoDto.setCreater(userid);
|
||||
Integer i = orderMapper.insertOrderInfo(orderInfoDto);
|
||||
j += i;
|
||||
|
|
@ -81,9 +82,9 @@ public class OrderServiceImpl implements OrderService {
|
|||
@Override
|
||||
public List<OrderInfoDto> getOrderDetails(OrderInfoDto orderInfoDto) throws Exception {
|
||||
if (orderInfoDto.isFlag()) {
|
||||
orderInfoDto.setSellerId(SecurityUtils.getLoginUser().getUserid().toString());
|
||||
orderInfoDto.setSellerCompany(SecurityUtils.getLoginUser().getSysUser().getCompanyId().intValue());
|
||||
} else {
|
||||
orderInfoDto.setBuyerId(SecurityUtils.getLoginUser().getUserid().toString());
|
||||
orderInfoDto.setBuyerCompany(SecurityUtils.getLoginUser().getSysUser().getCompanyId().intValue());
|
||||
}
|
||||
|
||||
List<OrderInfoDto> orderInfoDtos = orderMapper.getOrderDetails(orderInfoDto);
|
||||
|
|
|
|||
|
|
@ -390,6 +390,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="specification != null">specification = #{specification},</if>
|
||||
<if test="deposit != null">deposit = #{deposit},</if>
|
||||
<if test="isOperator != null">is_active = #{isOperator},</if>
|
||||
<if test="checkDate != null">check_date = #{checkDate},</if>
|
||||
<if test="checkCycle != null">check_cycle = #{checkCycle},</if>
|
||||
update_time = now()
|
||||
</trim>
|
||||
where ma_id = #{maId}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<mapper namespace="com.bonus.material.order.mapper.OrderMapper">
|
||||
|
||||
<insert id="insertOrderInfo" parameterType="com.bonus.material.order.domain.OrderInfoDto" useGeneratedKeys="true" keyProperty="orderId">
|
||||
insert into ma_order_info (code, order_time, cost, buyer_id, address, creater, create_time)
|
||||
insert into ma_order_info (code, order_time, cost, buyer_id, address, creater, create_time, buyer_company)
|
||||
values
|
||||
(#{code}, now(), #{cost}, #{buyerId}, #{address}, #{creater}, now())
|
||||
(#{code}, now(), #{cost}, #{buyerId}, #{address}, #{creater}, now(), #{buyerCompany})
|
||||
</insert>
|
||||
<insert id="insertOrderDetail">
|
||||
INSERT INTO `ma_order_details` (
|
||||
|
|
@ -86,46 +86,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
moi.code AS code,
|
||||
GROUP_CONCAT(hh.id) AS ids,
|
||||
moi.order_time,
|
||||
c.company_name AS czcompanyName,
|
||||
up.dept_name AS czcompanyName,
|
||||
mdi.person_phone AS personPhone,
|
||||
su.phonenumber AS phoneNumber,
|
||||
moi.address,
|
||||
moi.order_id,
|
||||
sum(hh.costs) cost,
|
||||
dept.companyName
|
||||
dept.dept_name as companyName
|
||||
FROM
|
||||
ma_order_details hh
|
||||
LEFT JOIN ma_order_info moi ON moi.order_id = hh.order_id
|
||||
LEFT JOIN ma_dev_info mdi ON hh.ma_id = mdi.ma_id
|
||||
LEFT JOIN bm_company_info c ON mdi.own_co = c.company_id
|
||||
LEFT JOIN ma_type mt ON mdi.type_id = mt.type_id
|
||||
LEFT JOIN sys_user su ON su.user_id = moi.buyer_id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
sd.dept_id AS deptId,
|
||||
sd1.dept_name AS companyName
|
||||
FROM
|
||||
sys_dept sd
|
||||
JOIN (
|
||||
SELECT
|
||||
CASE
|
||||
ancestors
|
||||
WHEN ( '0' ) THEN
|
||||
dept_id ELSE SUBSTRING_INDEX( SUBSTRING_INDEX( ancestors, ',', 2 ), ',', - 1 )
|
||||
END AS first_ancestor,
|
||||
dept_id
|
||||
FROM
|
||||
sys_dept
|
||||
) AS subquery ON sd.dept_id = subquery.dept_id
|
||||
LEFT JOIN sys_dept sd1 ON sd1.dept_id = subquery.first_ancestor
|
||||
) dept ON dept.deptId = su.dept_id
|
||||
left join sys_dept dept on dept.dept_id = moi.buyer_company
|
||||
left join sys_dept up on up.dept_id = mdi.own_co
|
||||
WHERE
|
||||
mt.del_flag = '0'
|
||||
<if test="buyerId != null and buyerId != ''">
|
||||
AND moi.buyer_id = #{buyerId}
|
||||
<if test="buyerCompany != null">
|
||||
AND moi.buyer_company = #{buyerCompany}
|
||||
</if>
|
||||
<if test="sellerId != null and sellerId != ''">
|
||||
AND mdi.own_id = #{sellerId}
|
||||
<if test="sellerCompany != null">
|
||||
AND mdi.own_co = #{sellerCompany}
|
||||
</if>
|
||||
<if test="deviceName != null and deviceName != ''">
|
||||
AND mdi.device_name like concat('%',#{deviceName},'%')
|
||||
|
|
@ -148,7 +130,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
AND mt.lease_price BETWEEN #{lowerBound} AND #{upperBound}
|
||||
</if>
|
||||
GROUP BY
|
||||
c.company_id,
|
||||
moi.buyer_company,
|
||||
moi.`code`,
|
||||
su.phonenumber,
|
||||
moi.address,
|
||||
|
|
|
|||
Loading…
Reference in New Issue