75 lines
3.4 KiB
XML
75 lines
3.4 KiB
XML
|
|
<?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.bonus.sgzb.material.mapper.PlanManagementMapper">
|
||
|
|
<insert id="insertPlanNeedInfo" useGeneratedKeys="true" keyProperty="planId">
|
||
|
|
insert into plan_need_info
|
||
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="unitId != null">unit_id,</if>
|
||
|
|
<if test="createBy != null">create_by,</if>
|
||
|
|
<if test="remark != null">remark,</if>
|
||
|
|
<if test="companyId != null">company_id,</if>
|
||
|
|
create_time
|
||
|
|
</trim>
|
||
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="unitId != null">#{unitId},</if>
|
||
|
|
<if test="createBy != null">#{createBy},</if>
|
||
|
|
<if test="remark != null">#{remark},</if>
|
||
|
|
<if test="companyId != null">#{companyId},</if>
|
||
|
|
now()
|
||
|
|
</trim>
|
||
|
|
</insert>
|
||
|
|
<insert id="insertPlanNeedDetail">
|
||
|
|
insert into plan_need_details
|
||
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="planId != null">plan_id,</if>
|
||
|
|
<if test="typeId != null">type_id,</if>
|
||
|
|
<if test="purchaseNum != null">plan_num,</if>
|
||
|
|
<if test="purchasePrice != null">plan_price,</if>
|
||
|
|
<if test="totalPrice != null">plan_cost,</if>
|
||
|
|
<if test="remark != null">remark,</if>
|
||
|
|
<if test="companyId != null">company_id,</if>
|
||
|
|
create_time
|
||
|
|
</trim>
|
||
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="planId != null">#{planId},</if>
|
||
|
|
<if test="typeId != null">#{typeId},</if>
|
||
|
|
<if test="purchaseNum != null">#{purchaseNum},</if>
|
||
|
|
<if test="purchasePrice != null">#{purchasePrice},</if>
|
||
|
|
<if test="totalPrice != null">#{totalPrice},</if>
|
||
|
|
<if test="remark != null">#{remark},</if>
|
||
|
|
<if test="companyId != null">#{companyId},</if>
|
||
|
|
now()
|
||
|
|
</trim>
|
||
|
|
</insert>
|
||
|
|
<select id="selectPlanInfo" resultType="com.bonus.sgzb.material.domain.PlanManagementVO">
|
||
|
|
SELECT pn.plan_id AS planId,
|
||
|
|
bu.unit_name AS lenderCompany,
|
||
|
|
bu.unit_id AS unitId,
|
||
|
|
pnd.plan_num AS lenderOrigPlanNum,
|
||
|
|
pnd.plan_price AS planPrice,
|
||
|
|
pnd.plan_cost AS planCost,
|
||
|
|
pn.create_by AS createBy,
|
||
|
|
pn.create_time AS createTime,
|
||
|
|
pn.remark AS remark,
|
||
|
|
mt2.type_name AS typeName,
|
||
|
|
mt.type_name AS typeModelName,
|
||
|
|
mt.unit_name AS unitName
|
||
|
|
FROM plan_need_info pn
|
||
|
|
LEFT JOIN plan_need_details pnd ON pn.plan_id = pnd.plan_id
|
||
|
|
LEFT JOIN bm_unit_info bu ON pn.unit_id = bu.unit_id
|
||
|
|
LEFT JOIN ma_type mt ON pnd.type_id = mt.type_id
|
||
|
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||
|
|
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
|
||
|
|
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
|
||
|
|
WHERE
|
||
|
|
1=1
|
||
|
|
<if test="name != null and name != ''">
|
||
|
|
and (bu.unit_name like concat('%', #{name}, '%') or
|
||
|
|
mt2.type_name like concat('%',#{name},'%') or
|
||
|
|
mt.type_name like concat('%',#{name},'%'))
|
||
|
|
</if>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
</mapper>
|