javacodeadmin/ruoyi-system/src/main/resources/mapper/system/UsersMapper.xml

586 lines
19 KiB
XML

<?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.ruoyi.system.mapper.UsersMapper">
<resultMap type="Users" id="UsersResult">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="nickname" column="nickname"/>
<result property="phone" column="phone"/>
<result property="password" column="password"/>
<result property="rememberToken" column="remember_token"/>
<result property="openid" column="openid"/>
<result property="avatar" column="avatar"/>
<result property="type" column="type"/>
<result property="workerTime" column="worker_time"/>
<result property="integral" column="integral"/>
<result property="totalIntegral" column="total_integral"/>
<result property="status" column="status"/>
<result property="level" column="level"/>
<result property="isWork" column="is_work"/>
<result property="commission" column="commission"/>
<result property="totalComm" column="total_comm"/>
<result property="margin" column="margin"/>
<result property="jobNumber" column="job_number"/>
<result property="prohibitTime" column="prohibit_time"/>
<result property="prohibitTimeNum" column="prohibit_time_num"/>
<result property="toa" column="toa"/>
<result property="serviceCityPid" column="service_city_pid"/>
<result property="serviceCityIds" column="service_city_ids"/>
<result property="skillIds" column="skill_ids"/>
<result property="propose" column="propose"/>
<result property="loginStatus" column="login_status"/>
<result property="isStop" column="is_stop"/>
<result property="middleAuth" column="middle_auth"/>
<result property="consumption" column="consumption"/>
<result property="servicefee" column="servicefee"/>
<result property="birthday" column="birthday"/>
<result property="balance" column="balance"/>
<result property="ismember" column="ismember"/>
<result property="memberBegin" column="member_begin"/>
<result property="memberEnd" column="member_end"/>
<result property="createdAt" column="created_at"/>
<result property="updatedAt" column="updated_at"/>
</resultMap>
<sql id="selectUsersVo">
select id,
name,
nickname,
phone,
password,
remember_token,
openid,
avatar,
type,
worker_time,
integral,
total_integral,
status,
level,
commission,
total_comm,
margin,
job_number,
prohibit_time,
prohibit_time_num,
toa,
service_city_pid,
service_city_ids,
skill_ids,
propose,
login_status,
is_stop,
middle_auth,
balance,
ismember,
member_begin,
member_end,
created_at,
is_work,
consumption,
servicefee,
birthday,
updated_at
from users
</sql>
<select id="selectUsersList" parameterType="Users" resultMap="UsersResult">
<include refid="selectUsersVo"/>
<where>
<if test="totalCommMin != null and totalCommMax != null">
and total_comm BETWEEN #{totalCommMin} AND #{totalCommMax}
</if>
<if test="marginMin != null and marginMax != null">
and margin BETWEEN #{marginMin} AND #{marginMax}
</if>
<if test="commissionMin != null and commissionMax != null">
and commission BETWEEN #{commissionMin} AND #{commissionMax}
</if>
<if test="name != null and name != ''">
and name like concat('%', #{name}, '%')
</if>
<if test="nickname != null and nickname != ''">
and nickname like concat('%', #{nickname}, '%')
</if>
<if test="jobNumber != null">
and job_number like concat('%', #{jobNumber}, '%')
</if>
<if test="phone != null and phone != ''">
and phone like concat('%', #{phone}, '%')
</if>
<if test="password != null and password != ''">
and password = #{password}
</if>
<if test="rememberToken != null and rememberToken != ''">
and remember_token = #{rememberToken}
</if>
<if test="openid != null and openid != ''">
and openid = #{openid}
</if>
<if test="avatar != null and avatar != ''">
and avatar = #{avatar}
</if>
<if test="type != null and type != ''">
and type = #{type}
</if>
<if test="workerTime != null">
and worker_time = #{workerTime}
</if>
<if test="integral != null">
and integral = #{integral}
</if>
<if test="totalIntegral != null">
and total_integral = #{totalIntegral}
</if>
<if test="status != null">
and status = #{status}
</if>
<if test="level != null">
and level = #{level}
</if>
<if test="commission != null">
and commission = #{commission}
</if>
<if test="totalComm != null">
and total_comm = #{totalComm}
</if>
<if test="margin != null">
and margin = #{margin}
</if>
<if test="prohibitTime != null">
and prohibit_time = #{prohibitTime}
</if>
<if test="prohibitTimeNum != null">
and prohibit_time_num = #{prohibitTimeNum}
</if>
<if test="toa != null">
and toa = #{toa}
</if>
<if test="serviceCityPid != null">
and service_city_pid = #{serviceCityPid}
</if>
<if test="serviceCityIds != null and serviceCityIds != ''">
and service_city_ids = #{serviceCityIds}
</if>
<if test="skillIds != null and skillIds != ''">
and skill_ids = #{skillIds}
</if>
<if test="propose != null">
and propose = #{propose}
</if>
<if test="loginStatus != null">
and login_status = #{loginStatus}
</if>
<if test="isStop != null">
and is_stop = #{isStop}
</if>
<if test="middleAuth != null">
and middle_auth = #{middleAuth}
</if>
<if test="createdAt != null">
and created_at = #{createdAt}
</if>
<if test="updatedAt != null">
and updated_at = #{updatedAt}
</if>
</where>
order by id desc
</select>
<select id="selectUsersById" parameterType="Long" resultMap="UsersResult">
<include refid="selectUsersVo"/>
where id = #{id}
</select>
<select id="selectUsersIsMaxNumber" parameterType="Long" resultMap="UsersResult">
<include refid="selectUsersVo"/>
ORDER BY job_number DESC LIMIT 1;
</select>
<select id="selectUsersByRememberToken" parameterType="String" resultMap="UsersResult">
<include refid="selectUsersVo"/>
where remember_token = #{rememberToken}
</select>
<select id="selectUsersByOpenid" parameterType="String" resultMap="UsersResult">
<include refid="selectUsersVo"/>
where openid = #{openid}
</select>
<select id="selectUsersByPhone" parameterType="String" resultMap="UsersResult">
<include refid="selectUsersVo"/>
where phone = #{phone}
</select>
<insert id="insertUsers" parameterType="Users" useGeneratedKeys="true" keyProperty="id">
insert into users
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">
name,
</if>
<if test="nickname != null">
nickname,
</if>
<if test="phone != null">
phone,
</if>
<if test="password != null">
password,
</if>
<if test="rememberToken != null">
remember_token,
</if>
<if test="openid != null">
openid,
</if>
<if test="avatar != null">
avatar,
</if>
<if test="type != null and type != ''">
type,
</if>
<if test="workerTime != null">
worker_time,
</if>
<if test="integral != null">
integral,
</if>
<if test="totalIntegral != null">
total_integral,
</if>
<if test="status != null">
status,
</if>
<if test="level != null">
level,
</if>
<if test="isWork != null">
is_work,
</if>
<if test="commission != null">
commission,
</if>
<if test="totalComm != null">
total_comm,
</if>
<if test="margin != null">
margin,
</if>
<if test="jobNumber != null">
job_number,
</if>
<if test="prohibitTime != null">
prohibit_time,
</if>
<if test="prohibitTimeNum != null">
prohibit_time_num,
</if>
<if test="toa != null">
toa,
</if>
<if test="serviceCityPid != null">
service_city_pid,
</if>
<if test="serviceCityIds != null">
service_city_ids,
</if>
<if test="skillIds != null">
skill_ids,
</if>
<if test="propose != null">
propose,
</if>
<if test="loginStatus != null">
login_status,
</if>
<if test="isStop != null">
is_stop,
</if>
<if test="middleAuth != null">
middle_auth,
</if>
<if test="balance != null">
balance,
</if>
<if test="ismember != null">
ismember,
</if>
<if test="memberBegin != null">
member_begin,
</if>
<if test="memberEnd != null">
member_end,
</if>
<if test="consumption != null">
consumption,
</if>
<if test="servicefee != null">
servicefee,
</if>
<if test="birthday != null">
birthday,
</if>
created_at,
updated_at
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">
#{name},
</if>
<if test="nickname != null">
#{nickname},
</if>
<if test="phone != null">
#{phone},
</if>
<if test="password != null">
#{password},
</if>
<if test="rememberToken != null">
#{rememberToken},
</if>
<if test="openid != null">
#{openid},
</if>
<if test="avatar != null">
#{avatar},
</if>
<if test="type != null and type != ''">
#{type},
</if>
<if test="workerTime != null">
#{workerTime},
</if>
<if test="integral != null">
#{integral},
</if>
<if test="totalIntegral != null">
#{totalIntegral},
</if>
<if test="status != null">
#{status},
</if>
<if test="level != null">
#{level},
</if>
<if test="isWork != null">
#{isWork},
</if>
<if test="commission != null">
#{commission},
</if>
<if test="totalComm != null">
#{totalComm},
</if>
<if test="margin != null">
#{margin},
</if>
<if test="jobNumber != null">
#{jobNumber},
</if>
<if test="prohibitTime != null">
#{prohibitTime},
</if>
<if test="prohibitTimeNum != null">
#{prohibitTimeNum},
</if>
<if test="toa != null">
#{toa},
</if>
<if test="serviceCityPid != null">
#{serviceCityPid},
</if>
<if test="serviceCityIds != null">
#{serviceCityIds},
</if>
<if test="skillIds != null">
#{skillIds},
</if>
<if test="propose != null">
#{propose},
</if>
<if test="loginStatus != null">
#{loginStatus},
</if>
<if test="isStop != null">
#{isStop},
</if>
<if test="middleAuth != null">
#{middleAuth},
</if>
<if test="balance != null">
#{middleAuth},
</if>
<if test="ismember != null">
#{middleAuth},
</if>
<if test="memberBegin != null">
#{memberBegin},
</if>
<if test="memberEnd != null">
#{memberEnd},
</if>
<if test="consumption != null">
#{consumption},
</if>
<if test="servicefee != null">
#{servicefee},
</if>
<if test="birthday != null">
#{birthday},
</if>
NOW(),
NOW()
</trim>
</insert>
<update id="updateUsers" parameterType="Users">
update users
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">
name = #{name},
</if>
<if test="nickname != null">
nickname = #{nickname},
</if>
<if test="phone != null">
phone = #{phone},
</if>
<if test="password != null">
password = #{password},
</if>
<if test="rememberToken != null">
remember_token = #{rememberToken},
</if>
<if test="openid != null">
openid = #{openid},
</if>
<if test="avatar != null">
avatar = #{avatar},
</if>
<if test="type != null and type != ''">
type = #{type},
</if>
<if test="workerTime != null">
worker_time = #{workerTime},
</if>
<if test="integral != null">
integral = #{integral},
</if>
<if test="totalIntegral != null">
total_integral = #{totalIntegral},
</if>
<if test="status != null">
status = #{status},
</if>
<if test="level != null">
level = #{level},
</if>
<if test="isWork != null">
is_work = #{isWork},
</if>
<if test="commission != null">
commission = #{commission},
</if>
<if test="totalComm != null">
total_comm = #{totalComm},
</if>
<if test="margin != null">
margin = #{margin},
</if>
<if test="jobNumber != null">
job_number = #{jobNumber},
</if>
<if test="prohibitTime != null">
prohibit_time = #{prohibitTime},
</if>
<if test="prohibitTimeNum != null">
prohibit_time_num = #{prohibitTimeNum},
</if>
<if test="toa != null">
toa = #{toa},
</if>
<if test="serviceCityPid != null">
service_city_pid = #{serviceCityPid},
</if>
<if test="serviceCityIds != null">
service_city_ids = #{serviceCityIds},
</if>
<if test="skillIds != null">
skill_ids = #{skillIds},
</if>
<if test="propose != null">
propose = #{propose},
</if>
<if test="loginStatus != null">
login_status = #{loginStatus},
</if>
<if test="isStop != null">
is_stop = #{isStop},
</if>
<if test="middleAuth != null">
middle_auth = #{middleAuth},
</if>
<if test="balance != null">
balance = #{balance},
</if>
<if test="ismember != null">
ismember = #{ismember},
</if>
<if test="memberBegin != null">
member_begin = #{memberBegin},
</if>
<if test="memberEnd != null">
member_end = #{memberEnd},
</if>
<if test="consumption != null">
consumption = #{consumption},
</if>
<if test="servicefee != null">
servicefee = #{servicefee},
</if>
<if test="birthday != null">
birthday = #{birthday},
</if>
updated_at = NOW()
</trim>
where id = #{id}
</update>
<delete id="deleteUsersById" parameterType="Long">
delete
from users
where id = #{id}
</delete>
<delete id="deleteUsersByIds" parameterType="String">
delete
from users where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectUsersByIds" parameterType="java.util.List" resultMap="UsersResult">
<include refid="selectUsersVo"/>
where id in
<foreach collection="list" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
</mapper>