MerchantFunctionRelationMapper.xml
4.57 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?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.com.glsx.merchants.mapper.MerchantFunctionRelationMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.merchants.entity.MerchantFunctionRelation">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="merchant_product_id" jdbcType="INTEGER" property="merchantProductId"/>
<result column="menu_id" jdbcType="INTEGER" property="menuId"/>
<result column="funciton_id" jdbcType="INTEGER" property="funcitonId"/>
<result column="created_by" jdbcType="INTEGER" property="createdBy"/>
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime"/>
<result column="updated_by" jdbcType="INTEGER" property="updatedBy"/>
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime"/>
<result column="del_flag" jdbcType="TINYINT" property="delFlag"/>
<result column="parentMenuId" jdbcType="TINYINT" property="parentMenuId"/>
<result column="menuName" jdbcType="VARCHAR" property="menuName"/>
<result column="functionName" jdbcType="VARCHAR" property="functionName"/>
<result column="function_value" jdbcType="VARCHAR" property="functionValue"/>
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
-->
id, merchant_product_id, menu_id, funciton_id, created_by, created_time, updated_by,
updated_time, del_flag, function_value
</sql>
<update id="deleteByMerAccRelId">
update platform_merchant_function_relation set del_flag=-1,updated_time=NOW() WHERE
merchant_product_id in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</update>
<select id="findByCondition" resultMap="BaseResultMap"
parameterType="java.lang.Integer">
select *,p2.parentId as parentMenuId,p2.menu_name as menuName,p3.function_name as functionName from platform_merchant_function_relation p1
left join platform_merchant_product_menu p2 on p1.menu_id=p2.id
left join platform_merchant_product_function p3 on p1.funciton_id=p3.id
where p1.merchant_product_id=#{id}
and p1.del_flag=0
</select>
<select id="findByMerchantProductId" resultMap="BaseResultMap">
select * from platform_merchant_function_relation
where del_flag = 0
and merchant_product_id IN
<foreach collection="merchantProductId" index="index" open="(" close=")" separator="," item="id">
#{id}
</foreach>
</select>
<update id="deleteByMenuId">
update platform_merchant_function_relation set del_flag = -1,
updated_by=#{merchantFunctionRelation.createdBy},
updated_time=NOW()
where 1 = 1 and menu_id = #{merchantFunctionRelation.menuId}
</update>
<update id="deleteByFunctionId">
update platform_merchant_function_relation set del_flag = -1,
updated_by=#{merchantFunctionRelation.createdBy},
updated_time=NOW()
where 1 = 1 and funciton_id = #{merchantFunctionRelation.funcitonId}
</update>
<update id="batchDelete">
<foreach collection="list" item="item" index="index" open="" close="" separator=";">
update platform_merchant_function_relation
<set>
del_flag = -1,updated_by=#{item.createdBy},updated_time=NOW(),
</set>
where merchant_product_id=#{item.merchantProductId} and menu_id=#{item.menuId}
<if test="item.funcitonId != null">
and funciton_id = #{item.funcitonId,jdbcType=INTEGER}
</if>
<if test="item.functionValue != null and item.functionValue != ''">
and function_value = #{item.functionValue}
</if>
</foreach>
</update>
<select id="findIdByProductRelIds" resultType="java.lang.Integer">
select id from platform_merchant_function_relation where del_flag = 0 and merchant_product_id in
<foreach collection="list" open="(" close=")" item="item" index="index" separator=",">
#{item}
</foreach>
</select>
<update id="deleteByIds">
update platform_merchant_function_relation set del_flag = -1 ,updated_time = NOW(),updated_by = #{updatedBy} where id in
<foreach collection="list" open="(" close=")" item="item" index="index" separator=",">
#{item}
</foreach>
</update>
</mapper>