Blame view

backend/bo/src/main/resources/mapper/BoEntMapper.xml 2.29 KB
8ea9c133   陈威   初始化提交
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
<?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.hotent.bo.persistence.dao.BoEntDao">
	<resultMap id="BOEnt" type="com.hotent.bo.model.BoEnt">
		<id property="id" column="id_" jdbcType="VARCHAR"/>
		<result property="packageId" column="package_id_" jdbcType="VARCHAR"/>
		<result property="name" column="name_" jdbcType="VARCHAR"/>
		<result property="desc" column="desc_" jdbcType="VARCHAR"/>
		<result property="status" column="status_" jdbcType="VARCHAR"/>
		<result property="createBy" column="create_by_" jdbcType="VARCHAR"/>
		<result property="createTime" column="create_time_" jdbcType="TIMESTAMP"/>
		<result property="isCreateTable" column="is_create_table_" jdbcType="NUMERIC"/>
		<result property="dsName" column="ds_name_" jdbcType="VARCHAR"/>
		<result property="tableName" column="table_name_" jdbcType="VARCHAR"/>
		<result property="isExternal" column="is_external_" jdbcType="NUMERIC"/>
		<result property="pk" column="pk_" jdbcType="VARCHAR"/>
		<result property="fk" column="fk_" jdbcType="VARCHAR"/>
		<result property="pkType" column="pk_type_" jdbcType="VARCHAR"/>
	</resultMap>

	<select id="getByDefId" parameterType="java.lang.String" resultMap="BOEnt">
		SELECT a.*,b.type_
		FROM
		form_bo_ent a
		INNER JOIN form_bo_ent_relation b ON a.id_ = b.ref_ent_id_
		WHERE
		b.bo_defid_ = #{defId}
	</select>
	
	<delete id="deleteByDefId" parameterType="java.lang.String">
		DELETE FROM
				form_bo_ent
		WHERE ID_ in (
			select ref_ent_id_ from form_bo_ent_relation where BO_DEFID_ = #{defId}
		)
	</delete>
	
	<select id="getByName"   parameterType="java.lang.String" resultMap="BOEnt">
		SELECT * FROM form_bo_ent
		WHERE
			upper(name_)=upper(#{name,jdbcType=VARCHAR})
	</select>
	
	<select id="getByTableName"   parameterType="java.lang.String" resultMap="BOEnt">
		SELECT * FROM form_bo_ent WHERE table_name_=#{tableName,jdbcType=VARCHAR}
	</select>
	
	<select id="getBySubEntId"   parameterType="java.lang.String" resultMap="BOEnt">
		SELECT ent.*,rela.type_  FROM form_bo_ent ent LEFT JOIN form_bo_ent_relation rela on ent.id_ = rela.REF_ENT_ID_ 
	    LEFT JOIN form_bo_ent_relation relb on relb.id_ = rela.parent_id_ 
	    where relb.REF_ENT_ID_ =#{entId,jdbcType=VARCHAR} 
	</select>
</mapper>