|  | @@ -3,25 +3,21 @@
 | 
	
		
			
				|  |  |  <mapper namespace="com.xunmei.core.resumption.mapper.AppRuleMapper">
 | 
	
		
			
				|  |  |      <select id="selectPageByCondition" resultType="com.xunmei.core.resumption.vo.appRule.AppRulePageVo">
 | 
	
		
			
				|  |  |          select a.id as id,
 | 
	
		
			
				|  |  | -        a.rule_name,
 | 
	
		
			
				|  |  | -        a.rule_type_id,
 | 
	
		
			
				|  |  | -        d.name as ruleTypeName,
 | 
	
		
			
				|  |  | +        a.name,
 | 
	
		
			
				|  |  | +        a.type,
 | 
	
		
			
				|  |  |          a.org_type as orgType,
 | 
	
		
			
				|  |  | -        a.rule_status as ruleStatus,
 | 
	
		
			
				|  |  | +        a.status as status,
 | 
	
		
			
				|  |  |          a.remark as remark,
 | 
	
		
			
				|  |  |          a.org_id as orgId,
 | 
	
		
			
				|  |  | -        d2.name as orgTypeText,
 | 
	
		
			
				|  |  |          org.name as orgName
 | 
	
		
			
				|  |  | -        from t_app_rule a
 | 
	
		
			
				|  |  | +        from core_resumption_rule a
 | 
	
		
			
				|  |  |          inner join sys_org org on a.org_id = org.id
 | 
	
		
			
				|  |  | -        inner join sys_dict_data d on a.rule_type_id=d.code and d.dict_code='rule_type'
 | 
	
		
			
				|  |  | -        inner join sys_dict_data d2 on org.type=d2.code and d2.dict_code='sys_org_type'
 | 
	
		
			
				|  |  |          <where>
 | 
	
		
			
				|  |  | -            <if test="appRule.ruleName != null and appRule.ruleName != ''">
 | 
	
		
			
				|  |  | -                and a.rule_name like CONCAT('%',#{appRule.ruleName},'%')
 | 
	
		
			
				|  |  | +            <if test="appRule.name != null and appRule.name != ''">
 | 
	
		
			
				|  |  | +                and a.name like CONCAT('%',#{appRule.name},'%')
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  | -            <if test="appRule.ruleTypeId != null and appRule.ruleTypeId != ''">
 | 
	
		
			
				|  |  | -                and a.rule_type_id = #{appRule.ruleTypeId}
 | 
	
		
			
				|  |  | +            <if test="appRule.type != null and appRule.type != ''">
 | 
	
		
			
				|  |  | +                and a.type = #{appRule.type}
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  |              <if test="appRule.orgType != null">
 | 
	
		
			
				|  |  |                  and a.org_type = #{appRule.orgType}
 | 
	
	
		
			
				|  | @@ -34,46 +30,51 @@
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <select id="getRuleGroupList" resultType="com.xunmei.core.resumption.vo.appRule.AppRuleGroupVo">
 | 
	
		
			
				|  |  | -        select r.id        as ruleId,
 | 
	
		
			
				|  |  | -               r.rule_name as ruleName,
 | 
	
		
			
				|  |  | -              d.name  as orgType,
 | 
	
		
			
				|  |  | -               r.org_type  as orgTypeId
 | 
	
		
			
				|  |  | -        from t_app_rule r
 | 
	
		
			
				|  |  | -                 inner join sys_dict_data d on r.rule_type_id = d.id and d.dict_code='sys_org_type'
 | 
	
		
			
				|  |  | -        where rule_status = 0
 | 
	
		
			
				|  |  | +        select r.id       as ruleId,
 | 
	
		
			
				|  |  | +               r.name     as name,
 | 
	
		
			
				|  |  | +               d.name     as orgType,
 | 
	
		
			
				|  |  | +               r.org_type as orgTypeId
 | 
	
		
			
				|  |  | +        from core_resumption_rule r
 | 
	
		
			
				|  |  | +                 inner join sys_dict_data d on r.type = d.id and d.dict_code = 'sys_org_type'
 | 
	
		
			
				|  |  | +        where status = 0
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    <select id="get" resultType="com.xunmei.core.resumption.vo.appRule.AppRuleInfoVo">
 | 
	
		
			
				|  |  | -        select r.id,
 | 
	
		
			
				|  |  | -               r.rule_name    as ruleName,
 | 
	
		
			
				|  |  | -               r.rule_type_id as ruleTypeId,
 | 
	
		
			
				|  |  | -               d.name         as ruleTypeName,
 | 
	
		
			
				|  |  | -               r.org_type     as orgType,
 | 
	
		
			
				|  |  | -               r.rule_status  as ruleStatus,
 | 
	
		
			
				|  |  | -               r.remark       as remark
 | 
	
		
			
				|  |  | -        from t_app_rule r
 | 
	
		
			
				|  |  | -                 inner join sys_dict_data d on r.rule_type_id = d.code and d.dict_code = 'rule_type'
 | 
	
		
			
				|  |  | -        where r.id = #{id}
 | 
	
		
			
				|  |  | -    </select>
 | 
	
		
			
				|  |  | +<!--    <select id="get" resultType="com.xunmei.core.resumption.vo.appRule.AppRuleInfoVo">-->
 | 
	
		
			
				|  |  | +<!--        select r.id,-->
 | 
	
		
			
				|  |  | +<!--               r.name     as name,-->
 | 
	
		
			
				|  |  | +<!--               r.type     as type,-->
 | 
	
		
			
				|  |  | +<!--               r.org_type as orgType,-->
 | 
	
		
			
				|  |  | +<!--               r.status   as status,-->
 | 
	
		
			
				|  |  | +<!--               r.remark   as remark-->
 | 
	
		
			
				|  |  | +<!--        from core_resumption_rule r-->
 | 
	
		
			
				|  |  | +<!--                 inner join sys_dict_data d on r.type = d.code and d.dict_code = 'rule_type'-->
 | 
	
		
			
				|  |  | +<!--        where r.id = #{id}-->
 | 
	
		
			
				|  |  | +<!--    </select>-->
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <select id="checkRuleNameRepeat" resultType="java.lang.Integer">
 | 
	
		
			
				|  |  | -        select count(id) from t_app_rule where rule_name=#{ruleName}
 | 
	
		
			
				|  |  | +        select count(id) from core_resumption_rule where name=#{name}
 | 
	
		
			
				|  |  |          <if test="id != null">
 | 
	
		
			
				|  |  |              and id != #{id}
 | 
	
		
			
				|  |  |          </if>
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  | -    <select id="checkRuleTypeUniformity" resultType="java.lang.Integer">
 | 
	
		
			
				|  |  | -        SELECT SUM(c) as c from (
 | 
	
		
			
				|  |  | -              SELECT count(0) as c FROM t_app_rule_item WHERE rule_id=#{id} and rule_type_id!= #{ruletype}
 | 
	
		
			
				|  |  | -              UNION
 | 
	
		
			
				|  |  | -              SELECT count(0) as c FROM t_app_rule_point WHERE rule_id=#{id} and rule_type_id!= #{ruletype} )a
 | 
	
		
			
				|  |  | -    </select>
 | 
	
		
			
				|  |  | +    <!--    <select id="checkRuleTypeUniformity" resultType="java.lang.Integer">-->
 | 
	
		
			
				|  |  | +    <!--        SELECT SUM(c) as c from (-->
 | 
	
		
			
				|  |  | +    <!--              SELECT count(0) as c FROM core_resumption_rule_item WHERE rule_id=#{id} and type!= #{ruletype}-->
 | 
	
		
			
				|  |  | +    <!--              UNION-->
 | 
	
		
			
				|  |  | +    <!--              SELECT count(0) as c FROM core_resumption_rule_point WHERE rule_id=#{id} and type!= #{ruletype} )a-->
 | 
	
		
			
				|  |  | +    <!--    </select>-->
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    <update id="updateItemRuleType">
 | 
	
		
			
				|  |  | -        update t_app_rule_item set rule_type_id=#{ruletype} where rule_id=#{id} and rule_type_id!=#{ruletype}
 | 
	
		
			
				|  |  | -    </update>
 | 
	
		
			
				|  |  | +<!--    <update id="updateItemRuleType">-->
 | 
	
		
			
				|  |  | +<!--        update core_resumption_rule_item-->
 | 
	
		
			
				|  |  | +<!--        set type=#{ruletype}-->
 | 
	
		
			
				|  |  | +<!--        where rule_id = #{id}-->
 | 
	
		
			
				|  |  | +<!--          and type != #{ruletype}-->
 | 
	
		
			
				|  |  | +<!--    </update>-->
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    <update id="updatePointRuleType">
 | 
	
		
			
				|  |  | -        update t_app_rule_point set rule_type_id=#{ruletype} where rule_id=#{id} and rule_type_id!=#{ruletype}
 | 
	
		
			
				|  |  | -    </update>
 | 
	
		
			
				|  |  | +<!--    <update id="updatePointRuleType">-->
 | 
	
		
			
				|  |  | +<!--        update core_resumption_rule_point-->
 | 
	
		
			
				|  |  | +<!--        set type=#{ruletype}-->
 | 
	
		
			
				|  |  | +<!--        where rule_id = #{id}-->
 | 
	
		
			
				|  |  | +<!--          and type != #{ruletype}-->
 | 
	
		
			
				|  |  | +<!--    </update>-->
 | 
	
		
			
				|  |  |  </mapper>
 |