DomesticPlanSummaryMapper.xml
2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?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.lframework.xingyun.sc.procurement.mappers.summary.DomesticPlanSummaryMapper">
<resultMap id="DomesticPlanSummary" type="com.lframework.xingyun.sc.procurement.entity.summary.DomesticPlanSummary">
<id column="id" property="id"/>
<result column="code" property="code"/>
<result column="summary_date" property="summaryDate"/>
<result column="total_quantity" property="totalQuantity"/>
<result column="weighted_avg_coordination" property="weightedAvgCoordination"/>
<result column="create_by_id" property="createById"/>
<result column="create_by" property="createBy"/>
<result column="create_time" property="createTime"/>
<result column="update_by_id" property="updateById"/>
<result column="update_by" property="updateBy"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<sql id="DomesticPlanSummary_sql">
SELECT
dps.id,
dps.code,
dps.summary_date,
dps.total_quantity,
dps.weighted_avg_coordination,
dps.create_by_id,
dps.create_by,
dps.create_time,
dps.update_by_id,
dps.update_by,
dps.update_time
FROM domestic_plan_summary AS dps
</sql>
<select id="query" resultMap="DomesticPlanSummary">
<include refid="DomesticPlanSummary_sql"/>
<where>
<if test="vo.code != null and vo.code != ''">
AND dps.code LIKE CONCAT('%', #{vo.code}, '%')
</if>
<if test="vo.startDate != null">
AND dps.summary_date >= #{vo.startDate}
</if>
<if test="vo.endDate != null">
AND dps.summary_date <= #{vo.endDate}
</if>
</where>
ORDER BY dps.summary_date DESC, dps.code DESC
</select>
<select id="findById" resultMap="DomesticPlanSummary">
<include refid="DomesticPlanSummary_sql"/>
WHERE dps.id = #{id}
</select>
<select id="countBySummaryDate" resultType="long">
SELECT COUNT(1) FROM domestic_plan_summary WHERE summary_date = #{summaryDate}
</select>
<select id="findMaxCodeByYearPrefix" resultMap="DomesticPlanSummary">
SELECT * FROM domestic_plan_summary WHERE code LIKE CONCAT(#{prefix}, '%') ORDER BY code DESC LIMIT 1
</select>
</mapper>