郑永安
2023-06-19 59e91a4e9ddaf23cebb12993c774aa899ab22d16
src/main/java/com/gk/firework/Mapper/mybatis/PatrolOrderInfoMapper.xml
对比新文件
@@ -0,0 +1,160 @@
<?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.gk.firework.Mapper.PatrolOrderInfoMapper" >
  <resultMap id="BaseResultMap" type="com.gk.firework.Domain.PatrolOrderInfo" >
    <!--          -->
    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="userid" property="userid" jdbcType="BIGINT" />
    <result column="companyid" property="companyid" jdbcType="BIGINT" />
    <result column="ismend" property="ismend" jdbcType="TINYINT" />
    <result column="createdby" property="createdby" jdbcType="VARCHAR" />
    <result column="createddate" property="createddate" jdbcType="TIMESTAMP" />
    <result column="modifiedby" property="modifiedby" jdbcType="VARCHAR" />
    <result column="modifieddate" property="modifieddate" jdbcType="TIMESTAMP" />
  </resultMap>
  <sql id="Base_Column_List" >
    <!--          -->
    id, userid, companyid, ismend, createdby, createddate, modifiedby, modifieddate
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
    <!--          -->
    select
    <include refid="Base_Column_List" />
    from patrolorder
    where id = #{id,jdbcType=BIGINT}
  </select>
  <select id="selectDataGrid" resultType="com.gk.firework.Domain.Vo.PatrolOrderVo">
    SELECT
     patrolorder.id,
      patrolorder.ismend,
      patrolorder.createdby,
      patrolorder.createddate,
      patrolorder.modifiedby,
      patrolorder.modifieddate,
      `user`.username as checkname,
      enterprise.enterprisename,
      enterprise.safetysupervision,
      enterprise.officeaddress,
      enterprise.officephone,
      mainprincipal.`name` as mainperson
    FROM
    patrolorder
    LEFT JOIN `user` on `user`.id = patrolorder.userid
    LEFT JOIN enterprise on enterprise.id = patrolorder.companyid
    LEFT JOIN enterprisestaff as mainprincipal ON enterprise.id = mainprincipal.belongid and mainprincipal.type = '主要负责人'
    <where>
      1=1
      and `user`.isdel = 0
      and enterprise.validflag = 1
      <if test="condition.starttime != null">
        and patrolorder.modifieddate &gt;= #{condition.starttime}
      </if>
      <if test="condition.endtime != null">
        and patrolorder.modifieddate &lt;= #{condition.endtime}
      </if>
      <if test="condition.ismend != null">
        and patrolorder.ismend = #{condition.ismend}
      </if>
      <if test="condition.enterprisename != null and condition.enterprisename != ''">
        and enterprise.enterprisename like CONCAT('%',#{condition.enterprisename},'%')
      </if>
      <if test="condition.enterprisetype != null and condition.enterprisetype != ''">
        and enterprise.enterprisetype = #{condition.enterprisetype}
      </if>
      <if test="condition.province != null and condition.province != ''">
        and enterprise.province = #{condition.province}
      </if>
      <if test="condition.city != null and condition.city != ''">
        and enterprise.city = #{condition.city}
      </if>
      <if test="condition.area != null and condition.area != ''">
        and enterprise.district = #{condition.area}
      </if>
      <if test="condition.town != null and condition.town != ''">
        and enterprise.street = #{condition.town}
      </if>
      <if test="condition.community != null and condition.community != ''">
        and enterprise.committee = #{condition.community}
      </if>
      <if test="condition.checkname != null and condition.checkname != ''">
        and `user`.username LIKE CONCAT('%',#{condition.checkname},'%')
      </if>
    </where>
  </select>
  <select id="selectListByEnterprise" resultType="com.gk.firework.Domain.Vo.PatrolOrderVo">
    SELECT
    patrolorder.id,
    patrolorder.ismend,
    patrolorder.createdby,
    patrolorder.createddate,
    patrolorder.modifiedby,
    patrolorder.modifieddate,
    `user`.username as checkname,
    enterprise.enterprisename,
    enterprise.safetysupervision,
    enterprise.officeaddress,
    enterprise.officephone,
    mainprincipal.`name` as mainperson
    FROM
    patrolorder
    LEFT JOIN `user` on `user`.id = patrolorder.userid
    LEFT JOIN enterprise on enterprise.id = patrolorder.companyid
    LEFT JOIN enterprisestaff as mainprincipal ON enterprise.id = mainprincipal.belongid and mainprincipal.type = '主要负责人'
    <where>
      1=1
      and `user`.isdel = 0
      and enterprise.validflag = 1
      <if test="enterprisename != null and enterprisename != ''">
        and enterprise.enterprisename like CONCAT('%',#{enterprisename},'%')
      </if>
      <if test="username != null and username != ''">
        and `user`.username LIKE CONCAT('%',#{username},'%')
      </if>
    </where>
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
    <!--          -->
    delete from patrolorder
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <update id="updateByPrimaryKeySelective" parameterType="com.gk.firework.Domain.PatrolOrderInfo" >
    <!--          -->
    update patrolorder
    <set >
      <if test="userid != null" >
        userid = #{userid,jdbcType=BIGINT},
      </if>
      <if test="companyid != null" >
        companyid = #{companyid,jdbcType=BIGINT},
      </if>
      <if test="ismend != null" >
        ismend = #{ismend,jdbcType=TINYINT},
      </if>
      <if test="createdby != null" >
        createdby = #{createdby,jdbcType=VARCHAR},
      </if>
      <if test="createddate != null" >
        createddate = #{createddate,jdbcType=TIMESTAMP},
      </if>
      <if test="modifiedby != null" >
        modifiedby = #{modifiedby,jdbcType=VARCHAR},
      </if>
      <if test="modifieddate != null" >
        modifieddate = #{modifieddate,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.gk.firework.Domain.PatrolOrderInfo" >
    <!--          -->
    update patrolorder
    set userid = #{userid,jdbcType=BIGINT},
      companyid = #{companyid,jdbcType=BIGINT},
      ismend = #{ismend,jdbcType=TINYINT},
      createdby = #{createdby,jdbcType=VARCHAR},
      createddate = #{createddate,jdbcType=TIMESTAMP},
      modifiedby = #{modifiedby,jdbcType=VARCHAR},
      modifieddate = #{modifieddate,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>