mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-04 12:13:24 +09:00
65 lines
2.8 KiB
XML
65 lines
2.8 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTO Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.no1.wms.resetpassword.ResetPasswordMapper">
|
|
<resultMap id="resetPasswordResultMap" type="resetPasswordDto">
|
|
<id column="id" property="id"/>
|
|
<result column="account_id" property="accountId"/>
|
|
<result column="date" property="date"/>
|
|
<result column="note" property="note"/>
|
|
<association property="accountDto" javaType="accountDto">
|
|
<id column="acc.id" property="id" />
|
|
<result column="acc.name" property="name" />
|
|
</association>
|
|
</resultMap>
|
|
|
|
<insert id="insert" parameterType="resetPasswordDto">
|
|
insert into reset_password
|
|
(id, account_id, note, date)
|
|
VALUES
|
|
(UUID(), (SELECT id from account where employee_number = #{employeeNumber} ), #{note}, NOW())
|
|
</insert>
|
|
|
|
<select id="resetpasswordAll" resultMap="resetPasswordResultMap" parameterType="map">
|
|
SELECT
|
|
id, account_id, note, date, acc.id, acc.name, acc.mail, acc.employee_number
|
|
from reset_password rs join account acc on rs.account_id = acc.id
|
|
<where>
|
|
<choose>
|
|
<when test="searchn == 1"> acc.activation = 1 and acc.name like concat('%',#{search},'%')</when>
|
|
<when test="searchn == 0"> acc.activation = 1 and acc.employee_number like concat('%',#{search},'%') </when>
|
|
</choose>
|
|
</where>
|
|
order by date desc limit #{start}, #{perPage}
|
|
</select>
|
|
|
|
<select id="count" resultMap="resetPasswordResultMap" parameterType="map">
|
|
SELECT
|
|
count(id)
|
|
<where>
|
|
<choose>
|
|
<when test="searchn == 1"> acc.activation = 1 and acc.name like concat('%',#{search},'%')</when>
|
|
<when test="searchn == 0"> acc.activation = 1 and acc.employee_number like concat('%',#{search},'%') </when>
|
|
</choose>
|
|
</where>
|
|
order by date desc limit #{start}, #{perPage}
|
|
</select>
|
|
|
|
<select id="selectAll" resultMap="resetPasswordResultMap" parameterType="map">
|
|
SELECT
|
|
id, account_id, note, date, acc.id, acc.name
|
|
from reset_password rs join account acc on rs.account_id = acc.id
|
|
<where>
|
|
<choose>
|
|
<when test="searchn == 1"> acc.activation = 1 and acc.name like concat('%',#{search},'%')</when>
|
|
<when test="searchn == 0"> acc.activation = 1 and acc.employee_number like concat('%',#{search},'%') </when>
|
|
</choose>
|
|
</where>
|
|
order by acc.id desc limit #{start}, #{perPage}
|
|
|
|
</select>
|
|
<delete id="delete" parameterType="resetPasswordDto">
|
|
delete from reset_password WHERE id = #{id}
|
|
</delete>
|
|
|
|
</mapper> |