|
@@ -1,68 +1,85 @@
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<?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">
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.xintong.visualinspection.dao.master.CheckRuleDao" >
|
|
<mapper namespace="com.xintong.visualinspection.dao.master.CheckRuleDao" >
|
|
|
- <resultMap id="BaseResultMap" type="com.xintong.visualinspection.bean.User" >
|
|
|
|
|
|
|
+ <resultMap id="BaseResultMap" type="com.xintong.visualinspection.bean.CheckRule" >
|
|
|
<id column="id" property="id" jdbcType="INTEGER" />
|
|
<id column="id" property="id" jdbcType="INTEGER" />
|
|
|
- <result column="username" property="username" jdbcType="VARCHAR" />
|
|
|
|
|
- <result column="age" property="age" jdbcType="INTEGER" />
|
|
|
|
|
- <result column="password" property="password" jdbcType="VARCHAR" />
|
|
|
|
|
- </resultMap>
|
|
|
|
|
- <resultMap id="userMap" type="com.xintong.visualinspection.bean.User">
|
|
|
|
|
- <id property="id" column="ID"/>
|
|
|
|
|
- <result property="username" column="username"/>
|
|
|
|
|
- <result property="password" column="PASSWORD"/>
|
|
|
|
|
- <collection property="roles" ofType="com.xintong.visualinspection.bean.Role">
|
|
|
|
|
- <result column="name" property="name"/>
|
|
|
|
|
|
|
+ <result column="name" property="name" jdbcType="VARCHAR" />
|
|
|
|
|
+ <result column="checked_person_type" property="checked_person_type" jdbcType="INTEGER" />
|
|
|
|
|
+ <result column="checked_position_id" property="checked_position_id" jdbcType="INTEGER" />
|
|
|
|
|
+ <result column="checked_dept_id" property="checked_dept_id" jdbcType="INTEGER" />
|
|
|
|
|
+ <collection property="check_items" ofType="com.xintong.visualinspection.bean.CheckItem"
|
|
|
|
|
+ javaType="ArrayList">
|
|
|
|
|
+ <id property="id" column="id"/>
|
|
|
|
|
+ <result property="name" column="name"/>
|
|
|
</collection>
|
|
</collection>
|
|
|
</resultMap>
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
+ <select id="selectItems" resultType="com.xintong.visualinspection.bean.CheckItem" parameterType="Long">
|
|
|
|
|
+ SELECT a.*,b.*
|
|
|
|
|
+ FROM check_rule a left join check_rule_item b on a.id=b.rule_id
|
|
|
|
|
+ WHERE id = #{id}
|
|
|
|
|
+ </select>
|
|
|
<select id="getAll" resultMap="BaseResultMap" >
|
|
<select id="getAll" resultMap="BaseResultMap" >
|
|
|
- SELECT
|
|
|
|
|
- id,username,age,password
|
|
|
|
|
- FROM sys_user
|
|
|
|
|
|
|
+ SELECT *
|
|
|
|
|
+ FROM check_rule
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getOne" parameterType="java.lang.Long" resultMap="BaseResultMap" >
|
|
<select id="getOne" parameterType="java.lang.Long" resultMap="BaseResultMap" >
|
|
|
- SELECT
|
|
|
|
|
- id,username,age,password
|
|
|
|
|
- FROM sys_user
|
|
|
|
|
|
|
+ SELECT a.*,b.*
|
|
|
|
|
+ FROM check_rule a left join check_rule_item b on a.id=b.rule_id
|
|
|
WHERE id = #{id}
|
|
WHERE id = #{id}
|
|
|
</select>
|
|
</select>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="getByName" parameterType="java.lang.String" resultMap="BaseResultMap" >
|
|
|
|
|
+ SELECT *
|
|
|
|
|
+ FROM check_rule
|
|
|
|
|
+ WHERE name like CONCAT('%',#{name},'%')
|
|
|
|
|
+ </select>
|
|
|
|
|
|
|
|
- <insert id="insert" parameterType="com.xintong.visualinspection.bean.User" >
|
|
|
|
|
|
|
+ <insert id="insert" parameterType="com.xintong.visualinspection.bean.CheckRule" >
|
|
|
INSERT INTO
|
|
INSERT INTO
|
|
|
- sys_user
|
|
|
|
|
- (username,age,password,TRUENAME,ORGANID,BIRTH,AGE,MOBILE,POSITIONID,SEX,WORKNO,IDNO)
|
|
|
|
|
|
|
+ check_rule
|
|
|
|
|
+ (name,checked_person_type,checked_position_id,checked_dept_id)
|
|
|
VALUES
|
|
VALUES
|
|
|
- (#{username}, #{age},#{password},#{truename},#{deptId},#{birth},#{age},#{mobile},#{positionId},#{sex},#{workno},#{idno})
|
|
|
|
|
|
|
+ (#{name}, #{checked_person_type},#{checked_position_id},#{checked_dept_id})
|
|
|
</insert>
|
|
</insert>
|
|
|
-
|
|
|
|
|
- <update id="update" parameterType="com.xintong.visualinspection.bean.User" >
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <insert id="insertRuleItem" parameterType="List" >
|
|
|
|
|
+ INSERT INTO check_rule_item
|
|
|
|
|
+ (rule_id,item_id)
|
|
|
|
|
+ VALUES
|
|
|
|
|
+ <foreach collection ="list" item="item" index= "index" separator =",">
|
|
|
|
|
+ (#{item.rule_id}, #{item.id})
|
|
|
|
|
+ </foreach >
|
|
|
|
|
+ </insert>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="getLastId" resultType="Long">
|
|
|
|
|
+ select last_insert_id()
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <update id="update" parameterType="com.xintong.visualinspection.bean.CheckRule" >
|
|
|
UPDATE
|
|
UPDATE
|
|
|
- sys_user
|
|
|
|
|
|
|
+ check_rule
|
|
|
SET
|
|
SET
|
|
|
- <if test="username != null">userName = #{username},</if>
|
|
|
|
|
- <if test="age != null">age = #{age},</if>
|
|
|
|
|
- <if test="password != null">password = #{password},</if>
|
|
|
|
|
- id = #{id}
|
|
|
|
|
|
|
+ <if test="name != null">name = #{name},</if>
|
|
|
|
|
+ <if test="checked_person_type != null">checked_person_type = #{checked_person_type},</if>
|
|
|
|
|
+ <if test="checked_position_id != null">checked_position_id = #{checked_position_id},</if>
|
|
|
|
|
+ <if test="checked_dept_id != null">checked_dept_id = #{checked_dept_id}</if>
|
|
|
WHERE
|
|
WHERE
|
|
|
id = #{id}
|
|
id = #{id}
|
|
|
</update>
|
|
</update>
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <delete id="deleteRuleItem" parameterType="java.lang.Long" >
|
|
|
|
|
+ DELETE FROM
|
|
|
|
|
+ check_rule_item
|
|
|
|
|
+ WHERE
|
|
|
|
|
+ rule_id = #{id}
|
|
|
|
|
+ </delete>
|
|
|
|
|
+
|
|
|
<delete id="delete" parameterType="java.lang.Long" >
|
|
<delete id="delete" parameterType="java.lang.Long" >
|
|
|
DELETE FROM
|
|
DELETE FROM
|
|
|
- sys_user
|
|
|
|
|
|
|
+ check_rule
|
|
|
WHERE
|
|
WHERE
|
|
|
id =#{id}
|
|
id =#{id}
|
|
|
</delete>
|
|
</delete>
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- <select id="findByUserName" parameterType="String" resultMap="userMap">
|
|
|
|
|
- select u.*
|
|
|
|
|
- ,r.name
|
|
|
|
|
- from sys_user u
|
|
|
|
|
- LEFT JOIN sys_role_user sru on u.id= sru.Sys_User_id
|
|
|
|
|
- LEFT JOIN sys_role r on sru.sys_role_id=r.id
|
|
|
|
|
- where username= #{username}
|
|
|
|
|
- </select>
|
|
|
|
|
</mapper>
|
|
</mapper>
|