All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.mingsoft.mdiy.dao.IModelDao.xml Maven / Gradle / Ivy

There is a newer version: 2.2.5
Show newest version
<?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="net.mingsoft.mdiy.dao.IModelDao">

	<resultMap id="resultMap" type="net.mingsoft.mdiy.entity.ModelEntity">
			<id column="id" property="id" /><!--编号 -->
				<result column="model_name" property="modelName" /><!--模型名称 -->
				<result column="model_table_name" property="modelTableName" /><!--模型表名 -->
				<result column="model_type" property="modelType" /><!--类型 -->
				<result column="model_custom_type" property="modelCustomType" /><!--下拉选择框 -->
				<result column="model_json" property="modelJson" /><!--json -->
				<result column="model_field" property="modelField" /><!--自定义字段 -->
				<result column="create_by" property="createBy" /><!--创建人 -->
				<result column="create_date" property="createDate" /><!--创建时间 -->
				<result column="update_by" property="updateBy" /><!--修改人 -->
				<result column="update_date" property="updateDate" /><!--修改时间 -->
				<result column="del" property="del" /><!--删除标记 -->
	</resultMap>

	<!--保存-->
	<insert id="saveEntity" useGeneratedKeys="true" keyProperty="id"
			parameterType="net.mingsoft.mdiy.entity.ModelEntity" >
		insert into mdiy_model
		<trim prefix="(" suffix=")" suffixOverrides=",">
				<if test="modelName != null and modelName != ''">model_name,</if>
				<if test="modelTableName != null and modelTableName != ''">model_table_name,</if>
				<if test="modelType != null and modelType != ''">model_type,</if>
				<if test="modelCustomType != null and modelCustomType != ''">model_custom_type,</if>
				<if test="modelJson != null and modelJson != ''">model_json,</if>
				<if test="modelField != null and modelField != ''">model_field,</if>
				<if test="createBy != null">create_by,</if>
				<if test="createDate != null">create_date,</if>
				<if test="updateBy != null">update_by,</if>
				<if test="updateDate != null">update_date,</if>
				<if test="del != null">del,</if>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides=",">
				<if test="modelName != null and modelName != ''">#{modelName},</if>
				<if test="modelTableName != null and modelTableName != ''">#{modelTableName},</if>
				<if test="modelType != null and modelType != ''">#{modelType},</if>
				<if test="modelCustomType != null and modelCustomType != ''">#{modelCustomType},</if>
				<if test="modelJson != null and modelJson != ''">#{modelJson},</if>
				<if test="modelField != null and modelField != ''">#{modelField},</if>
				<if test="createBy != null">#{createBy},</if>
				<if test="createDate != null">#{createDate},</if>
				<if test="updateBy != null">#{updateBy},</if>
				<if test="updateDate != null">#{updateDate},</if>
				<if test="del != null">#{del},</if>
		</trim>
	</insert>

		<!--更新-->
		<update id="updateEntity" parameterType="net.mingsoft.mdiy.entity.ModelEntity">
			update mdiy_model
			<set>
				<if test="modelName != null and modelName != ''">model_name=#{modelName},</if>
				<if test="modelTableName != null and modelTableName != ''">model_table_name=#{modelTableName},</if>
				<if test="modelType != null and modelType != ''">model_type=#{modelType},</if>
				<if test="modelCustomType != null and modelCustomType != ''">model_custom_type=#{modelCustomType},</if>
				<if test="modelJson != null and modelJson != ''">model_json=#{modelJson},</if>
				<if test="modelField != null and modelField != ''">model_field=#{modelField},</if>
				<if test="createBy != null">create_by=#{createBy},</if>
				<if test="createDate != null">create_date=#{createDate},</if>
				<if test="updateBy != null">update_by=#{updateBy},</if>
				<if test="updateDate != null">update_date=#{updateDate},</if>
				<if test="del != null">del=#{del},</if>
			</set>
			where id = #{id}
		</update>

		<!--根据实体获取-->
		<select id="getByEntity" resultMap="resultMap" parameterType="net.mingsoft.mdiy.entity.ModelEntity">
			select * from mdiy_model
			<where>
				<if test="modelName != null and modelName != ''">and  model_name like CONCAT(CONCAT('%',#{modelName}),'%')</if>
				<if test="modelTableName != null and modelTableName != ''">and model_table_name=#{modelTableName}</if>
				<if test="modelType != null and modelType != ''">and model_type=#{modelType}</if>
				<if test="modelCustomType != null and modelCustomType != ''">and model_custom_type=#{modelCustomType}</if>
				<if test="modelJson != null and modelJson != ''">and model_json=#{modelJson}</if>
				<if test="modelField != null and modelField != ''">and model_field=#{modelField}</if>
				<if test="createBy != null"> and create_by=#{createBy} </if>
				<if test="createDate != null"> and create_date=#{createDate} </if>
				<if test="updateBy != null"> and update_by=#{updateBy} </if>
				<if test="updateDate != null"> and update_date=#{updateDate} </if>
				<if test="del != null"> and del=#{del} </if>
			</where>
		</select>

		<!--批量删除-->
		<delete id="delete" >
			delete from mdiy_model
			<where>
				id  in <foreach collection="ids" item="item" index="index"
										 open="(" separator="," close=")">#{item}</foreach>
			</where>
		</delete>
		<!--查询全部-->
		<select id="queryAll" resultMap="resultMap">
			select * from mdiy_model order by id desc
		</select>
	<!--条件查询-->
	<select id="query" resultMap="resultMap">
		select * from mdiy_model
		<where>
			<if test="modelName != null and modelName != ''"> and  model_name=#{modelName}</if>
			<if test="modelTableName != null and modelTableName != ''"> and model_table_name=#{modelTableName}</if>
			<if test="modelType != null and modelType != ''"> and model_type=#{modelType}</if>
			<if test="modelCustomType != null and modelCustomType != ''"> and model_custom_type=#{modelCustomType}</if>
			<if test="modelJson != null and modelJson != ''"> and model_json=#{modelJson}</if>
			<if test="modelField != null and modelField != ''"> and model_field=#{modelField}</if>
			<if test="createBy != null"> and create_by=#{createBy} </if>
			<if test="createDate != null"> and create_date=#{createDate} </if>
			<if test="updateBy != null"> and update_by=#{updateBy} </if>
			<if test="updateDate != null"> and update_date=#{updateDate} </if>
			<if test="del != null"> and del=#{del} </if>
		</where>
		order by id desc
	</select>

</mapper>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy