对于系统的登录,还有Mapper层和controller层:
Mapper层包含一个.java文件和一个.xml文件:
public interface ReagentAdminLoginLogMapper {long countByExample(ReagentAdminLoginLogExample example);int deleteByExample(ReagentAdminLoginLogExample example);int deleteByPrimaryKey(Long id);int insert(ReagentAdminLoginLog record);int insertSelective(ReagentAdminLoginLog record);List<ReagentAdminLoginLog> selectByExample(ReagentAdminLoginLogExample example);ReagentAdminLoginLog selectByPrimaryKey(Long id);int updateByExampleSelective(@Param("record") ReagentAdminLoginLog record, @Param("example") ReagentAdminLoginLogExample example);int updateByExample(@Param("record") ReagentAdminLoginLog record, @Param("example") ReagentAdminLoginLogExample example);int updateByPrimaryKeySelective(ReagentAdminLoginLog record);int updateByPrimaryKey(ReagentAdminLoginLog record);
}
可以看出,里边的方法都是针对数据库操作,增删改查。
.xml文件与.java中的方法一一对应:写了具体的SQL语句
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis//DTD Mapper 3.0//EN" ".dtd">
<mapper namespace=ss.hrm.backend.mapper.ReagentMemberLoginLogMapper"><resultMap id="BaseResultMap" type=ss.del.ReagentMemberLoginLog"><id column="id" jdbcType="BIGINT" property="id" /><result column="member_id" jdbcType="BIGINT" property="memberId" /><result column="create_time" jdbcType="TIMESTAMP" property="createTime" /><result column="ip" jdbcType="VARCHAR" property="ip" /><result column="city" jdbcType="VARCHAR" property="city" /><result column="login_type" jdbcType="INTEGER" property="loginType" /><result column="province" jdbcType="VARCHAR" property="province" /></resultMap><sql id="Example_Where_Clause"><where><foreach collection="oredCriteria" item="criteria" separator="or"><if test="criteria.valid"><trim prefix="(" prefixOverrides="and" suffix=")"><foreach collection=iteria" item="criterion"><choose><when test=Value">and ${dition}</when><when test="criterion.singleValue">and ${dition} #{criterion.value}</when><when test="criterion.betweenValue">and ${dition} #{criterion.value} and #{criterion.secondValue}</when><when test="criterion.listValue">and ${dition}<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">#{listItem}</foreach></when></choose></foreach></trim></if></foreach></where></sql><sql id="Update_By_Example_Where_Clause"><where><foreach collection=dCriteria" item="criteria" separator="or"><if test="criteria.valid"><trim prefix="(" prefixOverrides="and" suffix=")"><foreach collection=iteria" item="criterion"><choose><when test=Value">and ${dition}</when><when test="criterion.singleValue">and ${dition} #{criterion.value}</when><when test="criterion.betweenValue">and ${dition} #{criterion.value} and #{criterion.secondValue}</when><when test="criterion.listValue">and ${dition}<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">#{listItem}</foreach></when></choose></foreach></trim></if></foreach></where></sql><sql id="Base_Column_List">id, member_id, create_time, ip, city, login_type, province</sql><select id="selectByExample" parameterType=ss.del.ReagentMemberLoginLogExample" resultMap="BaseResultMap">select<if test="distinct">distinct</if><include refid="Base_Column_List" />from reagent_member_login_log<if test="_parameter != null"><include refid="Example_Where_Clause" /></if><if test="orderByClause != null">order by ${orderByClause}</if></select><select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">select <include refid="Base_Column_List" />from reagent_member_login_logwhere id = #{id,jdbcType=BIGINT}</select><delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from reagent_member_login_logwhere id = #{id,jdbcType=BIGINT}</delete><delete id="deleteByExample" parameterType=ss.del.ReagentMemberLoginLogExample">delete from reagent_member_login_log<if test="_parameter != null"><include refid="Example_Where_Clause" /></if></delete><insert id="insert" parameterType=ss.del.ReagentMemberLoginLog"><selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">SELECT LAST_INSERT_ID()</selectKey>insert into reagent_member_login_log (member_id, create_time, ip, city, login_type, province)values (#{memberId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{ip,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, #{loginType,jdbcType=INTEGER}, #{province,jdbcType=VARCHAR})</insert><insert id="insertSelective" parameterType=ss.del.ReagentMemberLoginLog"><selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">SELECT LAST_INSERT_ID()</selectKey>insert into reagent_member_login_log<trim prefix="(" suffix=")" suffixOverrides=","><if test="memberId != null">member_id,</if><if test="createTime != null">create_time,</if><if test="ip != null">ip,</if><if test="city != null">city,</if><if test="loginType != null">login_type,</if><if test="province != null">province,</if></trim><trim prefix="values (" suffix=")" suffixOverrides=","><if test="memberId != null">#{memberId,jdbcType=BIGINT},</if><if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if><if test="ip != null">#{ip,jdbcType=VARCHAR},</if><if test="city != null">#{city,jdbcType=VARCHAR},</if><if test="loginType != null">#{loginType,jdbcType=INTEGER},</if><if test="province != null">#{province,jdbcType=VARCHAR},</if></trim></insert><select id="countByExample" parameterType=ss.del.ReagentMemberLoginLogExample" resultType="java.lang.Long">select count(*) from reagent_member_login_log<if test="_parameter != null"><include refid="Example_Where_Clause" /></if></select><update id="updateByExampleSelective" parameterType="map">update reagent_member_login_log<set><if test="record.id != null">id = #{record.id,jdbcType=BIGINT},</if><if test=berId != null">member_id = #{berId,jdbcType=BIGINT},</if><if test=ateTime != null">create_time = #{ateTime,jdbcType=TIMESTAMP},</if><if test="record.ip != null">ip = #{record.ip,jdbcType=VARCHAR},</if><if test="record.city != null">city = #{record.city,jdbcType=VARCHAR},</if><if test="record.loginType != null">login_type = #{record.loginType,jdbcType=INTEGER},</if><if test="record.province != null">province = #{record.province,jdbcType=VARCHAR},</if></set><if test="_parameter != null"><include refid="Update_By_Example_Where_Clause" /></if></update><update id="updateByExample" parameterType="map">update reagent_member_login_logset id = #{record.id,jdbcType=BIGINT},member_id = #{berId,jdbcType=BIGINT},create_time = #{ateTime,jdbcType=TIMESTAMP},ip = #{record.ip,jdbcType=VARCHAR},city = #{record.city,jdbcType=VARCHAR},login_type = #{record.loginType,jdbcType=INTEGER},province = #{record.province,jdbcType=VARCHAR}<if test="_parameter != null"><include refid="Update_By_Example_Where_Clause" /></if></update><update id="updateByPrimaryKeySelective" parameterType=ss.del.ReagentMemberLoginLog">update reagent_member_login_log<set><if test="memberId != null">member_id = #{memberId,jdbcType=BIGINT},</if><if test="createTime != null">create_time = #{createTime,jdbcType=TIMESTAMP},</if><if test="ip != null">ip = #{ip,jdbcType=VARCHAR},</if><if test="city != null">city = #{city,jdbcType=VARCHAR},</if><if test="loginType != null">login_type = #{loginType,jdbcType=INTEGER},</if><if test="province != null">province = #{province,jdbcType=VARCHAR},</if></set>where id = #{id,jdbcType=BIGINT}</update><update id="updateByPrimaryKey" parameterType=ss.del.ReagentMemberLoginLog">update reagent_member_login_logset member_id = #{memberId,jdbcType=BIGINT},create_time = #{createTime,jdbcType=TIMESTAMP},ip = #{ip,jdbcType=VARCHAR},city = #{city,jdbcType=VARCHAR},login_type = #{loginType,jdbcType=INTEGER},province = #{province,jdbcType=VARCHAR}where id = #{id,jdbcType=BIGINT}</update>
</mapper>
本文发布于:2024-01-29 01:55:56,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170646455911884.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |