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

net.mingsoft.people.dao.IPeopleUserDao.xml Maven / Gradle / Ivy

<?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.people.dao.IPeopleUserDao">

	<resultMap id="resultMap" type="net.mingsoft.people.entity.PeopleUserEntity">
		<id column="PEOPLE_ID" property="peopleId" /><!--用户ID关联people表的(id) -->
		<result column="PU_REAL_NAME" property="puRealName" /><!--用户真实名称 -->
		<result column="PU_ADDRESS" property="puAddress" /><!--用户地址 -->
		<result column="PU_ICON" property="puIcon" /><!--用户头像图标地址 -->
		<result column="pu_level" property="puLevel" /><!--用户等级 -->
		<result column="pu_level_name" property="puLevelName" /><!--用户等级名称 -->
		<result column="PU_NICKNAME" property="puNickname" /><!--用户昵称 -->
		<result column="PU_SEX" property="puSex" /><!--用户性别(0.未知、1.男、2.女) -->
		<result column="PU_BIRTHDAY" property="puBirthday" /><!--用户出生年月日 -->
		<result column="PU_CARD" property="puCard" /><!--身份证 -->
		<result column="province_id" property="provinceId" /><!--城市选择 -->
		<result column="province_name" property="provinceName" /><!--省 -->
		<result column="city_name" property="cityName" /><!--城市 -->
		<result column="county_name" property="countyName" /><!--区 -->
		<result column="city_id" property="cityId" /><!--城市id -->
		<result column="county_id" property="countyId" /><!--区id -->

		<result column="id" property="id"/><!-- 将实体的id属性与表的id字段对接 -->
		<result column="PEOPLE_PHONE" property="peoplePhone"/><!-- 将实体的peoplePhone属性与表的peoplePhone字段对接 -->
		<result column="PEOPLE_NAME" property="peopleName"/><!-- 将实体的peopleName属性与表的peopleName字段对接 -->
		<result column="PEOPLE_PASSWORD" property="peoplePassword"/><!-- 将实体的peoplePwd属性与表的peoplePwd字段对接 -->
		<result column="PEOPLE_DATETIME" property="peopleDateTime"/><!-- 将实体的peopleDateTime属性与表的peopleDateTime字段对接 -->
		<result column="PEOPLE_STATE" property="peopleState"/><!-- 用户邮箱 -->
		<result column="PEOPLE_MAIL" property="peopleMail"/><!-- 用户邮箱 -->
		<result column="PEOPLE_MAILLCHECK" property="peopleMailCheck"/>
		<result column="PEOPLE_PHONECHECK" property="peoplePhoneCheck"/>
	</resultMap>


	<!--保存-->
	<insert id="saveEntity"
		parameterType="net.mingsoft.people.entity.PeopleUserEntity" >
		insert into people_user
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="id &gt; 0">PEOPLE_ID,</if>
			<if test="puRealName != null and puRealName != ''">PU_REAL_NAME,</if>
			<if test="puAddress != null and puAddress != ''">PU_ADDRESS,</if>
			<if test="puLevel != null and puLevel != ''">pu_level,</if>
			<if test="puLevelName != null and puLevelName != ''">pu_level_name,</if>
			<if test="puIcon != null and puIcon != ''">PU_ICON,</if>
			<if test="puNickname != null and puNickname != ''">PU_NICKNAME,</if>
			<if test="puSex != null">PU_SEX,</if>
			<if test="puBirthday != null">PU_BIRTHDAY,</if>
			<if test="puCard != null and puCard != ''">PU_CARD,</if>
			<if test="provinceId != null">province_id,</if>
			<if test="provinceName != null and provinceName != ''">province_name,</if>
			<if test="cityName != null and cityName != ''">city_name,</if>
			<if test="countyName != null and countyName != ''">county_name,</if>
			<if test="cityId != null">city_id,</if>
			<if test="countyId != null">county_id,</if>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="id">#{id},</if>
			<if test="puRealName != null and puRealName != ''">#{puRealName},</if>
			<if test="puAddress != null and puAddress != ''">#{puAddress},</if>
			<if test="puLevel != null and puLevel != ''">#{puLevel},</if>
			<if test="puLevelName != null and puLevelName != ''">#{puLevelName},</if>
			<if test="puIcon != null and puIcon != ''">#{puIcon},</if>
			<if test="puNickname != null and puNickname != ''">#{puNickname},</if>
			<if test="puSex != null">#{puSex},</if>
			<if test="puBirthday != null">#{puBirthday},</if>
			<if test="puCard != null and puCard != ''">#{puCard},</if>
			<if test="provinceId != null">#{provinceId},</if>
			<if test="provinceName != null and provinceName != ''">#{provinceName},</if>
			<if test="cityName != null and cityName != ''">#{cityName},</if>
			<if test="countyName != null and countyName != ''">#{countyName},</if>
			<if test="cityId != null">#{cityId},</if>
			<if test="countyId != null">#{countyId},</if>
		</trim>
	</insert>

	<!--更新-->
	<update id="updateEntity" parameterType="net.mingsoft.people.entity.PeopleUserEntity">
		update people_user
		<set>
			<if test="puRealName != null and puRealName != ''">PU_REAL_NAME=#{puRealName},</if>
			<if test="puAddress != null and puAddress != ''">PU_ADDRESS=#{puAddress},</if>
			<if test="puLevel != null and puLevel != ''">pu_level=#{puLevel},</if>
			<if test="puLevelName != null and puLevelName != ''">pu_level_name=#{puLevelName},</if>
			PU_ICON=#{puIcon},
			<if test="puNickname != null and puNickname != ''">PU_NICKNAME=#{puNickname},</if>
			<if test="puSex != null">PU_SEX=#{puSex},</if>
			<if test="puBirthday != null">PU_BIRTHDAY=#{puBirthday},</if>
			<if test="puCard != null and puCard != ''">PU_CARD=#{puCard},</if>
			<if test="provinceId != null">province_id=#{provinceId},</if>
			<if test="provinceName != null and provinceName != ''">province_name=#{provinceName},</if>
			<if test="cityName != null and cityName != ''">city_name=#{cityName},</if>
			<if test="countyName != null and countyName != ''">county_name=#{countyName},</if>
			<if test="cityId != null">city_id=#{cityId},</if>
			<if test="countyId != null">county_id=#{countyId},</if>
		</set>
		where PEOPLE_ID = #{peopleId}
	</update>

	<!--根据id获取-->
	<select id="getEntity" resultMap="resultMap" parameterType="int">
		select * from people p left join people_user on
		id=PEOPLE_ID where PEOPLE_ID=#{peopleId}
	</select>

	<!--根据实体获取-->
	<select id="getByEntity" resultMap="resultMap" parameterType="net.mingsoft.people.entity.PeopleUserEntity">
		select * from people left join people_user on
		id=PEOPLE_ID
		<where>
			<if test="peopleMailCheck &gt; 0">
				and PEOPLE_MAILLCHECK=#{peopleMailCheck}
			</if>
			<if test="puRealName != null and puRealName != ''"> and PU_REAL_NAME=#{puRealName} </if>
			<if test="puAddress != null and puAddress != ''"> and PU_ADDRESS=#{puAddress} </if>
			<if test="puLevel != null and puLevel != ''"> and pu_level=#{puLevel} </if>
			<if test="puLevelName != null and puLevelName != ''"> and pu_level_name=#{puLevelName} </if>
			<if test="puIcon != null and puIcon != ''"> and PU_ICON=#{puIcon} </if>
			<if test="puNickname != null and puNickname != ''"> and PU_NICKNAME=#{puNickname} </if>
			<if test="puSex != null"> and PU_SEX=#{puSex} </if>
			<if test="puBirthday != null"> and PU_BIRTHDAY=#{puBirthday} </if>
			<if test="puCard != null and puCard != ''"> and PU_CARD=#{puCard} </if>
			<if test="provinceId != null"> and province_id=#{provinceId} </if>
			<if test="provinceName != null and provinceName != ''">and province_name=#{provinceName}</if>
			<if test="cityName != null and cityName != ''">and city_name=#{cityName}</if>
			<if test="countyName != null and countyName != ''">and county_name=#{countyName}</if>
			<if test="cityId != null"> and city_id=#{cityId} </if>
			<if test="countyId != null"> and county_id=#{countyId} </if>
			<if test="peopleMail != null and peopleMail !=''"> and PEOPLE_MAIL=#{peopleMail} </if>
			<if test="peoplePhone != null and peoplePhone !=''"> and PEOPLE_PHONE=#{peoplePhone} </if>
		</where>
	</select>


	<!--删除-->
	<delete id="deleteEntity" parameterType="int">
		delete from people_user  where PEOPLE_ID=#{id}
	</delete>

	<!--批量删除-->
	<delete id="delete" >
		delete from people_user
		<where>
			 PEOPLE_ID  in <foreach collection="ids" item="item" index="index"
			open="(" separator="," close=")">#{item}</foreach>
		</where>
	</delete>
	<!--查询全部-->
	<select id="queryAll" resultMap="resultMap">
		select * from people_user order by PEOPLE_ID desc
	</select>
	<!--条件查询-->
	<select id="query" resultMap="resultMap">
		select * from people p left join people_user on
		id=PEOPLE_ID
		<where>
				<if test="peopleId &gt; 0 and peopleId != null"> and PEOPLE_ID=#{peopleId} </if>
				<if test="peopleState &gt; -1 and peopleState != null"> and PEOPLE_STATE=#{peopleState} </if>
				<if test="peopleName != null and peopleName != ''"> and PEOPLE_NAME like CONCAT(CONCAT('%',#{peopleName}),'%') </if>
				<if test="puRealName != null and puRealName != ''"> and PU_REAL_NAME like CONCAT(CONCAT('%',#{puRealName}),'%') </if>
				<if test="puAddress != null and puAddress != ''"> and PU_ADDRESS=#{puAddress} </if>
				<if test="puLevel != null and puLevel != ''"> and pu_level=#{puLevel} </if>
				<if test="puLevelName != null and puLevelName != ''"> and pu_level_name=#{puLevelName} </if>
				<if test="puIcon != null and puIcon != ''"> and PU_ICON=#{puIcon} </if>
				<if test="peopleMail != null and peopleMail != ''"> and PEOPLE_MAIL like CONCAT(CONCAT('%',#{peopleMail}),'%')</if>
				<if test="peoplePhone != null and peoplePhone != ''"> and PEOPLE_PHONE like CONCAT(CONCAT('%',#{peoplePhone}),'%')</if>
				<if test="puNickname != null and puNickname != ''"> and PU_NICKNAME like CONCAT(CONCAT('%',#{puNickname}),'%')</if>
				<if test="puSex &gt; 0"> and PU_SEX=#{puSex} </if>
				<if test="puBirthday != null"> and PU_BIRTHDAY=#{puBirthday} </if>
				<if test="puCard != null and puCard != ''"> and PU_CARD=#{puCard} </if>
			<if test="provinceId != null"> and province_id=#{provinceId} </if>
			<if test="provinceName != null and provinceName != ''"> and province_name=#{provinceName}</if>
			<if test="cityName != null and cityName != ''"> and city_name=#{cityName}</if>
			<if test="countyName != null and countyName != ''"> and county_name=#{countyName}</if>
			<if test="cityId != null"> and city_id=#{cityId} </if>
			<if test="countyId != null"> and county_id=#{countyId} </if>
				<if test="startTime != null and endTime != null">
				<if test="_databaseId == 'mysql'">
					and date_format(PEOPLE_DATETIME,'%Y-%m-%d') between #{startTime} and #{endTime}
				</if>
				<if test="_databaseId == 'oracle'">
					and to_char(PEOPLE_DATETIME,'yyyy-mm-dd') > #{startTime}
					and #{endTime} > to_char(PEOPLE_DATETIME,'yyyy-mm-dd')
				</if>
				</if>
		</where>
		order by PEOPLE_ID desc
	</select>


	<!--批量删除-->
	<select id="queryBatchIds" parameterType="java.util.List" resultMap="resultMap">
		select * from people_user
		<where>
			PEOPLE_ID  in <foreach collection="peopleIds" item="item" index="index"
								   open="(" separator="," close=")">#{item}</foreach>
		</where>
	</select>

</mapper>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy