mqtt通讯修改 增加模板 计算属性
This commit is contained in:
@@ -0,0 +1,150 @@
|
||||
<?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.xinda.iot.mapper.StandardMapper">
|
||||
|
||||
<resultMap type="com.xinda.iot.domain.Standard" id="StandardResult">
|
||||
<result property="standardId" column="standard_id" />
|
||||
<result property="standardName" column="standard_name" />
|
||||
<result property="tenantId" column="tenant_id" />
|
||||
<result property="tenantName" column="tenant_name" />
|
||||
<result property="isSys" column="is_sys" />
|
||||
<result property="orderNum" column="order_num" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="com.xinda.iot.model.IdAndName" id="StandardShortResult">
|
||||
<result property="id" column="standard_id" />
|
||||
<result property="name" column="standard_name" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectStandardVo">
|
||||
select standard_id, standard_name, tenant_id, tenant_name, is_sys,order_num, create_time, update_time, remark from iot_standard
|
||||
</sql>
|
||||
|
||||
<select id="selectStandardList" parameterType="com.xinda.iot.domain.Standard" resultMap="StandardResult">
|
||||
select c.standard_id, c.standard_name, c.tenant_id, c.tenant_name,
|
||||
c.is_sys,c.order_num, c.create_time, c.update_time, c.remark
|
||||
from iot_standard c
|
||||
<where>
|
||||
<if test="deptId != null and showSenior and !isAdmin">
|
||||
and ( c.tenant_id = #{tenantId}
|
||||
or (c.tenant_id in (
|
||||
SELECT de.dept_user_id
|
||||
FROM sys_dept de
|
||||
WHERE FIND_IN_SET( de.dept_id,(
|
||||
SELECT d.ancestors
|
||||
FROM sys_dept d
|
||||
WHERE d.dept_id = #{deptId} )
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
</if>
|
||||
<if test="!showSenior and tenantId != null and tenantId != 0 and !isAdmin">
|
||||
and c.tenant_id = #{tenantId}
|
||||
</if>
|
||||
<if test="standardName != null and standardName != ''"> and c.standard_name like concat('%', #{standardName}, '%')</if>
|
||||
<if test="tenantId != null and tenantId != ''"> and (c.tenant_id = #{tenantId} or c.is_sys = 1)</if>
|
||||
</where>
|
||||
order by order_num
|
||||
</select>
|
||||
|
||||
<select id="selectStandardShortList" resultMap="StandardShortResult">
|
||||
select c.standard_id, c.standard_name
|
||||
from iot_standard c
|
||||
<where>
|
||||
<if test="deptId != null and showSenior and !isAdmin">
|
||||
and ( c.tenant_id = #{tenantId}
|
||||
or (c.tenant_id in (
|
||||
SELECT de.dept_user_id
|
||||
FROM sys_dept de
|
||||
WHERE FIND_IN_SET( de.dept_id,(
|
||||
SELECT d.ancestors
|
||||
FROM sys_dept d
|
||||
WHERE d.dept_id = #{deptId} )
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
</if>
|
||||
<if test="!showSenior and tenantId != null and tenantId != 0 and !isAdmin">
|
||||
and c.tenant_id = #{tenantId}
|
||||
</if>
|
||||
<if test="standardName != null and standardName != ''"> and c.standard_name like concat('%', #{standardName}, '%')</if>
|
||||
<if test="tenantId != null and tenantId != ''"> and (c.tenant_id = #{tenantId} or c.is_sys = 1)</if>
|
||||
</where>
|
||||
order by order_num
|
||||
</select>
|
||||
|
||||
<select id="selectStandardByStandardId" parameterType="Long" resultMap="StandardResult">
|
||||
<include refid="selectStandardVo"/>
|
||||
where standard_id = #{standardId}
|
||||
</select>
|
||||
|
||||
<insert id="insertStandard" parameterType="com.xinda.iot.domain.Standard" useGeneratedKeys="true" keyProperty="standardId">
|
||||
insert into iot_standard
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="standardName != null and standardName != ''">standard_name,</if>
|
||||
<if test="tenantId != null">tenant_id,</if>
|
||||
<if test="tenantName != null and tenantName != ''">tenant_name,</if>
|
||||
<if test="isSys != null">is_sys,</if>
|
||||
<if test="orderNum != null">order_num,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="standardName != null and standardName != ''">#{standardName},</if>
|
||||
<if test="tenantId != null">#{tenantId},</if>
|
||||
<if test="tenantName != null and tenantName != ''">#{tenantName},</if>
|
||||
<if test="isSys != null">#{isSys},</if>
|
||||
<if test="orderNum != null">#{orderNum},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateStandard" parameterType="com.xinda.iot.domain.Standard">
|
||||
update iot_standard
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="standardName != null and standardName != ''">standard_name = #{standardName},</if>
|
||||
<if test="tenantId != null">tenant_id = #{tenantId},</if>
|
||||
<if test="tenantName != null and tenantName != ''">tenant_name = #{tenantName},</if>
|
||||
<if test="isSys != null">is_sys = #{isSys},</if>
|
||||
<if test="orderNum != null">order_num = #{orderNum},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where standard_id = #{standardId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteStandardByStandardId" parameterType="Long">
|
||||
delete from iot_standard where standard_id = #{standardId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteStandardByStandardIds" parameterType="String">
|
||||
delete from iot_standard where standard_id in
|
||||
<foreach item="standardId" collection="array" open="(" separator="," close=")">
|
||||
#{standardId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="productCountInStandards" parameterType="String" resultType="int">
|
||||
select count(*) from iot_product where standard_id in
|
||||
<foreach item="standardId" collection="array" open="(" separator="," close=")">
|
||||
#{standardId}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user