ProductMapper.xml
2.08 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
<?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.canrd.shop.mapper.ProductMapper">
<resultMap id="BaseResultMap" type="com.canrd.shop.module.dto.ProductDO">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="name" property="name"/>
</resultMap>
<select id="queryAll" resultMap="BaseResultMap">
select distinct p.id,p.name,p.productImageListStore,p.htmlFilePath
from product p
left join productcategoryrelation pcr on p.id=pcr.productId
left join productcategory pc on pc.id=pcr.categoryId
left join productfunctionrelation pfr on p.id=pfr.productId
left join productfunction pf on pf.id=pfr.functionId
${ew.customSqlSegment}
</select>
<select id="queryList" resultMap="BaseResultMap">
select distinct p.id,p.name,p.productImageListStore,p.htmlFilePath,p.productCategory_id
from product p
left join productcategoryrelation pcr on p.id=pcr.productId
left join productcategory pc on pc.id=pcr.categoryId
left join productfunctionrelation pfr on p.id=pfr.productId
left join productfunction pf on pf.id=pfr.functionId
left join tickettype tt on p.id=tt.productId
${ew.customSqlSegment}
</select>
<select id="selectAll" resultMap="BaseResultMap">
select distinct p.id,p.name,p.productImageListStore,p.htmlFilePath,pc.id as pcid
from product p
left join productcategoryrelation pcr on p.id=pcr.productId
left join productcategory pc on pc.id=pcr.categoryId
${ew.customSqlSegment}
</select>
<select id="selectList" resultMap="BaseResultMap">
select ${ew.sqlSelect}
from product p
left join productcategoryrelation pcr on p.id=pcr.productId
left join productcategory pc on pc.id=pcr.categoryId
${ew.customSqlSegment}
</select>
</mapper>