SmartProductMapper.xml
3.17 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.glsx.smart.dao.mapper.SmartProductMapper">
<resultMap id="BaseResultMap" type="com.glsx.smart.dao.entity.SmartProduct">
<!--@mbg.generated-->
<!--@Table smart_product-->
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="product_name" jdbcType="VARCHAR" property="productName"/>
<result column="icon" jdbcType="BIGINT" property="icon"/>
<result column="type_id" jdbcType="BIGINT" property="typeId"/>
<result column="shop_product_id" jdbcType="VARCHAR" property="shopProductId"/>
<result column="platform_key" jdbcType="VARCHAR" property="platformKey"/>
<result column="platform_product_id" jdbcType="VARCHAR" property="platformProductId"/>
<result column="network_key" jdbcType="VARCHAR" property="networkKey"/>
<result column="status" jdbcType="TINYINT" property="status"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="create_by" jdbcType="BIGINT" property="createBy"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="update_by" jdbcType="BIGINT" property="updateBy"/>
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, product_name, icon, type_id, shop_product_id, platform_key, platform_product_id,
network_key, `status`, remark, create_time, create_by, update_time, update_by
</sql>
<select id="getList" resultMap="BaseResultMap">
select sp.id, sp.product_name, sp.icon, sp.type_id, sp.shop_product_id, sp.platform_key,
sp.platform_product_id, sp.network_key, sp.status, sp.remark, sp.create_time,
sp.create_by, sp.update_time, sp.update_by,
ssf.url iconUrl,
spt.type_name typeName
from smart_product sp
left join smart_sys_file ssf on ssf.id = sp.icon
left join smart_product_type spt on spt.id = sp.type_id
<where>
<if test="productName != null and productName != ''">
and sp.product_name like concat('%', #{productName,jdbcType=VARCHAR}, '%')
</if>
</where>
order by sp.create_time desc
</select>
<select id="getById" resultMap="BaseResultMap">
select sp.id, sp.product_name, sp.icon, sp.type_id, sp.shop_product_id, sp.platform_key,
sp.platform_product_id, sp.network_key, sp.status, sp.remark, sp.create_time,
sp.create_by, sp.update_time, sp.update_by,
ssf.url iconUrl,
spt.type_name typeName
from smart_product sp
left join smart_sys_file ssf on ssf.id = sp.icon
left join smart_product_type spt on spt.id = sp.type_id
where sp.id = #{id,jdbcType=BIGINT}
</select>
<select id="countByProductName" resultType="integer">
select count(0)
from smart_product
where product_name = #{productName,jdbcType=VARCHAR}
</select>
</mapper>