|
@@ -21,13 +21,15 @@
|
|
|
<result column="create_time_" property="createTime" />
|
|
|
<result column="update_time_" property="updateTime" />
|
|
|
<result column="tenant_id_" property="tenantId" />
|
|
|
+ <result column="lock_flag_" property="lockFlag" />
|
|
|
+ <result column="subsidy_" property="subsidy" />
|
|
|
<association property="sysUser" resultMap="com.keao.edu.user.dao.SysUserDao.SysUser"/>
|
|
|
</resultMap>
|
|
|
<sql id="organizationColumn">
|
|
|
o.id_ organization_id_, o.user_id_, o.name_, o.contact_name_, o.contact_phone_,
|
|
|
o.settlement_type_, o.share_profit_amount_, o.level_, o.parent_organ_id_,
|
|
|
o.parent_organ_id_tag_, o.create_time_,
|
|
|
- o.update_time_, o.del_flag_, o.tenant_id_
|
|
|
+ o.update_time_, o.del_flag_, o.tenant_id_,o.subsidy_
|
|
|
</sql>
|
|
|
|
|
|
<!-- 根据主键查询一条记录 -->
|
|
@@ -45,15 +47,20 @@
|
|
|
|
|
|
<!-- 向数据库增加一条记录 -->
|
|
|
<insert id="insert" parameterType="com.keao.edu.user.entity.Organization" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
|
- INSERT INTO organization (id_,user_id_,name_,contact_name_,contact_phone_,level_,parent_organ_id_,parent_organ_id_tag_,settlement_type_,share_profit_amount_,create_time_,update_time_,tenant_id_)
|
|
|
- VALUES(#{id},#{userId},#{name},#{contactName},#{contactPhone},#{level},#{parentOrganId},#{parentOrganIdTag},#{settlementType,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
|
|
|
- #{shareProfitAmount},NOW(),NOW(),#{tenantId})
|
|
|
+ INSERT INTO organization (id_,user_id_,name_,contact_name_,contact_phone_,level_,parent_organ_id_,
|
|
|
+ parent_organ_id_tag_,settlement_type_,share_profit_amount_,create_time_,update_time_,tenant_id_,subsidy_)
|
|
|
+ VALUES(#{id},#{userId},#{name},#{contactName},#{contactPhone},#{level},#{parentOrganId},#{parentOrganIdTag},
|
|
|
+ #{settlementType,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
|
|
|
+ #{shareProfitAmount},NOW(),NOW(),#{tenantId},#{subsidy})
|
|
|
</insert>
|
|
|
|
|
|
<!-- 根据主键查询一条记录 -->
|
|
|
<update id="update" parameterType="com.keao.edu.user.entity.Organization">
|
|
|
UPDATE organization
|
|
|
<set>
|
|
|
+ <if test="subsidy != null">
|
|
|
+ subsidy_ = #{subsidy},
|
|
|
+ </if>
|
|
|
<if test="contactPhone != null">
|
|
|
contact_phone_ = #{contactPhone},
|
|
|
</if>
|
|
@@ -98,40 +105,42 @@
|
|
|
|
|
|
<sql id="organQueryPage">
|
|
|
<where>
|
|
|
- del_flag_ = 0
|
|
|
+ o.del_flag_ = 0
|
|
|
<if test="settlementType != null and settlementType != ''">
|
|
|
- AND settlement_type_ = #{settlementType}
|
|
|
+ AND o.settlement_type_ = #{settlementType}
|
|
|
</if>
|
|
|
<if test="tenantId != null and tenantId != 0">
|
|
|
- AND tenant_id_ = #{tenantId}
|
|
|
+ AND o.tenant_id_ = #{tenantId}
|
|
|
</if>
|
|
|
<if test="organId != null">
|
|
|
- AND parent_organ_id_ = #{organId}
|
|
|
+ AND o.parent_organ_id_ = #{organId}
|
|
|
</if>
|
|
|
<if test="organIds != null">
|
|
|
- AND id_ IN
|
|
|
+ AND o.id_ IN
|
|
|
<foreach collection="organIds" item="organId" separator="," open="(" close=")">
|
|
|
#{organId}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
<if test="search != null and search != ''">
|
|
|
- AND (id_ = #{search} OR name_ LIKE CONCAT('%',#{search},'%')
|
|
|
- OR contact_name_ LIKE CONCAT('%',#{search},'%')
|
|
|
- OR contact_phone_ LIKE CONCAT('%',#{search},'%'))
|
|
|
+ AND (o.id_ = #{search} OR name_ LIKE CONCAT('%',#{search},'%')
|
|
|
+ OR o.contact_name_ LIKE CONCAT('%',#{search},'%')
|
|
|
+ OR o.contact_phone_ LIKE CONCAT('%',#{search},'%'))
|
|
|
</if>
|
|
|
</where>
|
|
|
</sql>
|
|
|
|
|
|
<!-- 分页查询 -->
|
|
|
<select id="queryPage" resultMap="Organization" parameterType="map">
|
|
|
- SELECT <include refid="organizationColumn"/> FROM organization o
|
|
|
+ SELECT <include refid="organizationColumn"/>,e.lock_flag_ FROM organization o
|
|
|
+ LEFT JOIN employee e ON o.user_id_ = e.user_id_
|
|
|
<include refid="organQueryPage"/>
|
|
|
- ORDER BY update_time_ DESC <include refid="global.limit"/>
|
|
|
+ ORDER BY o.update_time_ DESC
|
|
|
+ <include refid="global.limit"/>
|
|
|
</select>
|
|
|
|
|
|
<!-- 查询当前表的总记录数 -->
|
|
|
<select id="queryCount" resultType="int">
|
|
|
- SELECT COUNT(*) FROM organization
|
|
|
+ SELECT COUNT(o.id_) FROM organization o
|
|
|
<include refid="organQueryPage"/>
|
|
|
</select>
|
|
|
|