<?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.hzya.frame.sys.appParameter.dao.impl.SysAppParameterMapperImpl">
	<resultMap id="get-entity-result" type="com.hzya.frame.sys.appParameter.entity.SysAppParameter">
		<!--主键 -->
		<result property="id" column="ID" />
		<!--应用id -->
		<result property="appId" column="app_id" />
		<!--参数 -->
		<result property="parameter" column="parameter" />
		<!--数据类型 -->
		<result property="dateType" column="date_type" />
		<!--参数描述 -->
		<result property="description" column="description" />
		<!--是否必填 -->
		<result property="requireds" column="requireds" />
		<!--参数值 -->
		<result property="dateValue" column="date_value" />
		<!--备注 -->
		<result property="remarks" column="remarks" />
		<!--排序号 -->
		<result property="sorts" column="sorts" />
		<!--组织机构ID -->
		<result property="orgId" column="org_id" />
		<!--状态 1有效 0无效 -->
		<result property="sts" column="sts" />
		<!--创建人ID -->
		<result property="createUserId" column="create_user_id" />
		<!--创建时间ID -->
		<result property="createTime" column="create_time" />
		<!--修改时间 -->
		<result property="modifyTime" column="modify_time" />
		<!--修改人ID -->
		<result property="modifyUserId" column="modify_user_id" />
	</resultMap>

	<sql id="Sysappparameter_Base_Column_List">
		ID as id,
		app_id as app_id,
		parameter as parameter,
		date_type as date_type,
		description as description,
		requireds as requireds,
		date_value as date_value,
		remarks as remarks,
		sorts as sorts,
		org_id as org_id,
		sts as sts,
		create_user_id as create_user_id,
		create_time as create_time,
		modify_time as modify_time,
		modify_user_id as modify_user_id
	</sql>

	<!--通过ID获取数据 -->
	<select id="entity_get" resultMap="get-entity-result">
		select
		<include refid="Sysappparameter_Base_Column_List" />
		from sys_app_parameter where sts = 'Y' and  id = #{id}
	</select>

	<!-- 查询 采用==查询 -->
	<select id="entity_list_base" resultMap="get-entity-result" parameterType="com.hzya.frame.sys.appParameter.entity.SysAppParameter">
		select
		<include refid="Sysappparameter_Base_Column_List" />
		from sys_app_parameter
		<trim prefix="where" prefixOverrides="and">
			<if test="id != null ">ID= #{id} </if>
			<if test="appId != null and appId !='' "> and app_id = #{appId} </if>
			<if test="parameter != null and parameter !='' "> and parameter = #{parameter}</if>
			<if test="dateType != null and dateType !='' "> and date_type = #{dateType}</if>
			<if test="description != null and description !='' "> and description = #{description}</if>
			<if test="requireds != null and requireds !='' "> and requireds = #{requireds}</if>
			<if test="dateValue != null and dateValue !='' "> and date_value = #{dateValue}</if>
			<if test="remarks != null and remarks !='' "> and remarks = #{remarks}</if>
			<if test="sorts != null "> and sorts = #{sorts}</if>
			<if test="orgId != null and orgId !='' "> and org_id = #{orgId}</if>
			<if test="sts != null and sts !='' "> and sts = #{sts}</if>
			<if test="createUserId != null and createUserId !='' "> and create_user_id = #{createUserId}</if>
			<if test="createTime != null and createTime !='' "> and create_time = #{createTime}</if>
			<if test="modifyTime != null and modifyTime !='' "> and modify_time = #{modifyTime}</if>
			<if test="modifyUserId != null and modifyUserId !='' "> and modify_user_id = #{modifyUserId}</if>
		</trim>
		order by sorts asc
	</select>



	<!-- 分页查询列表 采用like格式 -->
	<select id="entity_list_like" resultMap="get-entity-result" parameterType="com.hzya.frame.sys.appParameter.entity.SysAppParameter">
		select
		<include refid="Sysappparameter_Base_Column_List" />
		from sys_app_parameter
		<trim prefix="where" prefixOverrides="and">
			<if test="id != null ">ID = #{id}</if>
			<if test="appId != null and appId !='' "> and  app_id like concat('%',#{appId},'%') </if>
			<if test="parameter != null and parameter !='' "> and parameter like concat('%',#{parameter},'%') </if>
			<if test="dateType != null and dateType !='' "> and date_type like concat('%',#{dateType},'%') </if>
			<if test="description != null and description !='' "> and description like concat('%',#{description},'%') </if>
			<if test="requireds != null and requireds !='' "> and requireds like concat('%',#{requireds},'%') </if>
			<if test="dateValue != null and dateValue !='' "> and date_value like concat('%',#{dateValue},'%') </if>
			<if test="remarks != null and remarks !='' "> and remarks like concat('%',#{remarks},'%') </if>
			<if test="sorts != null "> and sorts like concat('%', #{sorts},'%')</if>
			<if test="orgId != null and orgId !='' "> and org_id like concat('%', #{orgId},'%')</if>
			<if test="sts != null and sts !='' "> and sts like concat('%', #{sts},'%')</if>
			<if test="createUserId != null and createUserId !='' "> and create_user_id like concat('%', #{createUserId},'%')</if>
			<if test="createTime != null and createTime !='' "> and create_time like concat('%', #{createTime},'%')</if>
			<if test="modifyTime != null and modifyTime !='' "> and modify_time like concat('%', #{modifyTime},'%')</if>
			<if test="modifyUserId != null and modifyUserId !='' "> and modify_user_id like concat('%', #{modifyUserId},'%')</if>
		</trim>
		order by sorts asc
	</select>

	<!-- 查询列表 字段采用or格式 -->
	<select id="entity_list_or" resultMap="get-entity-result" parameterType="com.hzya.frame.sys.appParameter.entity.SysAppParameter">
		select
		<include refid="Sysappparameter_Base_Column_List" />
		from sys_app_parameter
		<trim prefix="where" prefixOverrides="or">
			<if test="id != null ">ID = #{id}</if>
			<if test="appId != null and appId !='' "> or app_id = #{appId} </if>
			<if test="parameter != null and parameter !='' "> or parameter = #{parameter} </if>
			<if test="dateType != null and dateType !='' "> or date_type = #{dateType} </if>
			<if test="description != null and description !='' "> or description = #{description} </if>
			<if test="requireds != null and requireds !='' "> or requireds = #{requireds} </if>
			<if test="dateValue != null and dateValue !='' "> or date_value = #{dateValue} </if>
			<if test="remarks != null and remarks !='' "> or remarks = #{remarks} </if>
			<if test="sorts != null "> or sorts = #{sorts}</if>
			<if test="orgId != null and orgId !='' "> or org_id = #{orgId}</if>
			<if test="sts != null and sts !='' "> or sts = #{sts}</if>
			<if test="createUserId != null and createUserId !='' "> or create_user_id = #{createUserId}</if>
			<if test="createTime != null and createTime !='' "> or create_time = #{createTime}</if>
			<if test="modifyTime != null and modifyTime !='' "> or modify_time = #{modifyTime}</if>
			<if test="modifyUserId != null and modifyUserId !='' "> or modify_user_id = #{modifyUserId}</if>
		</trim>
		order by sorts asc
	</select>
	<!-- 新增 -->
	<insert id="entity_insert" parameterType="com.hzya.frame.sys.appParameter.entity.SysAppParameter">
		insert into sys_app_parameter(
		<trim suffix="" suffixOverrides=",">
			<if test="id != null ">ID,</if>
			<if test="appId != null and appId !='' "> app_id, </if>
			<if test="parameter != null and parameter !='' "> parameter, </if>
			<if test="dateType != null and dateType !='' "> date_type, </if>
			<if test="description != null and description !='' "> description, </if>
			<if test="requireds != null and requireds !='' "> requireds, </if>
			<if test="dateValue != null and dateValue !='' "> date_value, </if>
			<if test="remarks != null and remarks !='' "> remarks, </if>
			<if test="sorts != null ">sorts,</if>
			<if test="orgId != null ">org_id,</if>
			<if test="sts != null ">sts,</if>
			<if test="createUserId != null ">create_user_id,</if>
			<if test="createTime != null ">create_time,</if>
			<if test="modifyTime != null ">modify_time,</if>
			<if test="modifyUserId != null ">modify_user_id,</if>
		</trim>
		)values
		(
		<trim suffix="" suffixOverrides=",">
			<if test="id != null ">#{id},</if>
			<if test="appId != null and appId !='' "> #{appId}, </if>
			<if test="parameter != null and parameter !='' "> #{parameter}, </if>
			<if test="dateType != null and dateType !='' "> #{dateType}, </if>
			<if test="description != null and description !='' "> #{description}, </if>
			<if test="requireds != null and requireds !='' "> #{requireds}, </if>
			<if test="dateValue != null and dateValue !='' "> #{dateValue}, </if>
			<if test="remarks != null and remarks !='' "> #{remarks}, </if>
			<if test="sorts != null ">#{sorts},</if>
			<if test="orgId != null ">#{orgId},</if>
			<if test="sts != null ">#{sts},</if>
			<if test="createUserId != null ">#{createUserId},</if>
			<if test="createTime != null ">#{createTime},</if>
			<if test="modifyTime != null ">#{modifyTime},</if>
			<if test="modifyUserId != null ">#{modifyUserId},</if>
		</trim>
		)
	</insert>

	<!-- 修改 -->
	<update id="entity_update" parameterType="com.hzya.frame.sys.appParameter.entity.SysAppParameter">
		update sys_app_parameter set
		<trim suffix="" suffixOverrides=",">
			<if test="id != null ">ID = #{id},</if>
			<if test="appId != null and appId !='' "> app_id = #{appId},</if>
			<if test="parameter != null and parameter !='' "> parameter = #{parameter},</if>
			<if test="dateType != null and dateType !='' "> date_type = #{dateType},</if>
			<if test="description != null and description !='' "> description = #{description},</if>
			<if test="requireds != null and requireds !='' "> requireds = #{requireds},</if>
			<if test="dateValue != null and dateValue !='' "> date_value = #{dateValue},</if>
			<if test="remarks != null and remarks !='' "> remarks = #{remarks},</if>
			<if test="sorts != null ">sorts = #{sorts},</if>
			<if test="orgId != null ">org_id = #{orgId},</if>
			<if test="sts != null ">sts = #{sts},</if>
			<if test="createUserId != null ">create_user_id = #{createUserId},</if>
			<if test="createTime != null ">create_time = #{createTime},</if>
			<if test="modifyTime != null ">modify_time = #{modifyTime},</if>
			<if test="modifyUserId != null ">modify_user_id = #{modifyUserId},</if>
		</trim>
		where id = #{id}
	</update>
	<!-- 逻辑删除多条件 -->
	<update id="logicDelete_Multi_Condition" parameterType="com.hzya.frame.sys.appParameter.entity.SysAppParameter">
		update sys_app_parameter set
		sts='N',modify_time = #{modifyTime} ,modify_user_id = #{modifyUserId}
		<trim prefix="where" prefixOverrides="and">
			<if test="id != null ">and ID = #{id}</if>
			<if test="appId != null and appId !='' "> and app_id = #{appId}</if>
			<if test="parameter != null and parameter !='' ">and  parameter = #{parameter}</if>
			<if test="dateType != null and dateType !='' ">and  date_type = #{dateType}</if>
			<if test="description != null and description !='' ">and  description = #{description}</if>
			<if test="requireds != null and requireds !='' ">and  requireds = #{requireds}</if>
			<if test="dateValue != null and dateValue !='' "> and date_value = #{dateValue}</if>
			<if test="remarks != null and remarks !='' ">and  remarks = #{remarks}</if>
			<if test="sorts != null ">and sorts = #{sorts}</if>
			<if test="orgId != null ">and org_id = #{orgId}</if>
			<if test="sts != null ">and sts = #{sts}</if>
			<if test="createUserId != null ">and create_user_id = #{createUserId}</if>
			<if test="createTime != null ">and create_time = #{createTime}</if>
		</trim>
	</update>
	<!-- 物理删除 -->
	<delete id="entity_delete" parameterType="com.hzya.frame.sys.appParameter.entity.SysAppParameter">
		delete from sys_app_parameter where id =#{id}
	</delete>
</mapper>
