159 lines
7.3 KiB
XML
159 lines
7.3 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.ruoyi.invest.mapper.FutureStocksBillMapper">
|
|
|
|
<resultMap type="FutureStocksBillVo" id="FutureStocksBillResult">
|
|
<result property="id" column="id" />
|
|
<result property="name" column="name" />
|
|
<result property="billDate" column="bill_date" />
|
|
<result property="futureStocksId" column="future_stocks_id" />
|
|
<result property="billDatePeriod" column="bill_date_period" />
|
|
<result property="billAmount" column="bill_amount" />
|
|
<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" />
|
|
<result property="type" column="type" />
|
|
<result property="billYear" column="bill_year" />
|
|
<result property="billMonth" column="bill_month" />
|
|
<result property="remark" column="remark" />
|
|
<result property="futureStocksName" column="future_stocks_name" />
|
|
<result property="futureStocksCode" column="future_stocks_code" />
|
|
</resultMap>
|
|
|
|
<sql id="selectFutureStocksBillVo">
|
|
select
|
|
a.id,
|
|
a.name,
|
|
a.bill_date,
|
|
a.future_stocks_id,
|
|
a.bill_date_period,
|
|
a.bill_amount,
|
|
a.create_by,
|
|
a.create_time,
|
|
a.update_by,
|
|
a.update_time,
|
|
a.del_flag,
|
|
a.type,
|
|
a.bill_year,
|
|
a.bill_month,
|
|
a.remark,
|
|
fs2 ."name" as future_stocks_name,
|
|
fs2.code as future_stocks_code
|
|
from
|
|
future_stocks_bill a
|
|
left join future_stocks fs2 on fs2 .id =a.future_stocks_id
|
|
|
|
</sql>
|
|
|
|
<select id="selectFutureStocksBillList" parameterType="FutureStocksBillDto" resultMap="FutureStocksBillResult">
|
|
<include refid="selectFutureStocksBillVo"/>
|
|
<where>
|
|
a.del_flag='0'
|
|
<if test="name != null and name != ''"> and a.name like '%'|| #{name}||'%'</if>
|
|
<if test="billDate != null "> and a.bill_date = #{billDate}</if>
|
|
<if test="futureStocksId != null "> and a.future_stocks_id = #{futureStocksId}</if>
|
|
<if test="billDatePeriod != null and billDatePeriod != ''"> and a.bill_date_period = #{billDatePeriod}</if>
|
|
<if test="billAmount != null and billAmount != ''"> and a.bill_amount = #{billAmount}</if>
|
|
<if test="type != null and type != ''"> and a.type = #{type}</if>
|
|
<if test="startMonth!=null and startMonth !=''">
|
|
and to_char(a.bill_date, 'yyyy-MM')>=#{startMonth}
|
|
</if>
|
|
<if test="endMonth!=null and endMonth !=''">
|
|
and #{endMonth}>=to_char(a.bill_date, 'yyyy-MM')
|
|
</if>
|
|
</where>
|
|
<!-- 数据范围过滤 -->
|
|
${params.dataScope}
|
|
order by a.bill_date_period desc
|
|
</select>
|
|
|
|
<select id="selectFutureStocksBillById" parameterType="Long" resultMap="FutureStocksBillResult">
|
|
<include refid="selectFutureStocksBillVo"/>
|
|
where a.id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertFutureStocksBill" parameterType="FutureStocksBill">
|
|
insert into future_stocks_bill
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">id,</if>
|
|
<if test="name != null">name,</if>
|
|
<if test="billDate != null">bill_date,</if>
|
|
<if test="futureStocksId != null">future_stocks_id,</if>
|
|
<if test="billDatePeriod != null">bill_date_period,</if>
|
|
<if test="billAmount != null">bill_amount,</if>
|
|
<if test="createBy != null">create_by,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateBy != null">update_by,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
<if test="delFlag != null">del_flag,</if>
|
|
<if test="type != null">type,</if>
|
|
<if test="billYear != null">bill_year,</if>
|
|
<if test="billMonth != null">bill_month,</if>
|
|
<if test="remark != null">remark,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">#{id},</if>
|
|
<if test="name != null">#{name},</if>
|
|
<if test="billDate != null">#{billDate},</if>
|
|
<if test="futureStocksId != null">#{futureStocksId},</if>
|
|
<if test="billDatePeriod != null">#{billDatePeriod},</if>
|
|
<if test="billAmount != null">#{billAmount},</if>
|
|
<if test="createBy != null">#{createBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
<if test="delFlag != null">#{delFlag},</if>
|
|
<if test="type != null">#{type},</if>
|
|
<if test="billYear != null">#{billYear},</if>
|
|
<if test="billMonth != null">#{billMonth},</if>
|
|
<if test="remark != null">#{remark},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateFutureStocksBill" parameterType="FutureStocksBill">
|
|
update future_stocks_bill
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="name != null">name = #{name},</if>
|
|
<if test="billDate != null">bill_date = #{billDate},</if>
|
|
<if test="futureStocksId != null">future_stocks_id = #{futureStocksId},</if>
|
|
<if test="billDatePeriod != null">bill_date_period = #{billDatePeriod},</if>
|
|
<if test="billAmount != null">bill_amount = #{billAmount},</if>
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
|
<if test="type != null">type = #{type},</if>
|
|
<if test="billYear != null">bill_year = #{billYear},</if>
|
|
<if test="billMonth != null">bill_month = #{billMonth},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteFutureStocksBillById" parameterType="Long">
|
|
delete from future_stocks_bill where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteFutureStocksBillByIds" parameterType="String">
|
|
delete from future_stocks_bill where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
<update id="removeFutureStocksBillById" parameterType="Long">
|
|
update future_stocks_bill set del_flag='1' where id = #{id}
|
|
</update>
|
|
|
|
<update id="removeFutureStocksBillByIds" parameterType="String">
|
|
update future_stocks_bill set del_flag='1' where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</update>
|
|
</mapper>
|