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
<?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="cn.wise.sc.cement.business.mapper.StandardMapper">
<select id="getStandardDetaulList" resultType="cn.wise.sc.cement.business.model.vo.StandardValueVo">
SELECT standard_id as id,element_value,element_name FROM `standard_value` sv
LEFT JOIN
(SELECT id FROM standard) s
ON sv.standard_id = s.id
</select>
<sql id="where">
<where>
<if test="params.supplierName != null and params.supplierName != ''">
and t.supplier_name = #{params.supplierName}
</if>
<if test="params.name != null and params.name != ''">
and t.name like concat('%', #{params.name}, '%')
</if>
</where>
</sql>
<select id="exportList" resultType="java.util.HashMap">
SELECT
(@i:=@i+1) as 序号,
t.name as 标样名称,
t.code as 标物代号,
t.supplier_name as 经销单位,
t.position as 存放位置,
t.purchase_date as 进样日期,
t.valid_date as 有效日期,
t.stock_num as 剩余库存,
(
CASE t.status
WHEN 0 THEN '已作废'
WHEN 1 THEN '启用中'
ELSE NULL
END
) as 状态
FROM standard t ,(select @i:=0)t
<include refid="where"/>
ORDER BY t.id DESC
</select>
<select id="getStandardsByGroup" resultType="cn.wise.sc.cement.business.entity.StandardGroupDto">
select s.id as group_id,s.`name` as group_name,sv.element_name,sv.element_value FROM standard s
INNER JOIN
(SELECT * FROM standard_value) sv
ON s.id = sv.standard_id
</select>
</mapper>