|  |  |  | 
|---|
|  |  |  | * @param createdBy | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | int createMerchantServiceRelation(@Param("merchantId") Long merchantId, @Param("serviceId") Long serviceId, | 
|---|
|  |  |  | int createMerchantServiceRelation(@Param("id")Long id,@Param("merchantId") Long merchantId, @Param("serviceId") Long serviceId, | 
|---|
|  |  |  | @Param("name") String name, @Param("createdBy") Long createdBy); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.annotation.Resource; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.panzhihua.common.utlis.Snowflake; | 
|---|
|  |  |  | import org.springframework.beans.BeanUtils; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
|---|
|  |  |  | 
|---|
|  |  |  | List<Long> serviceIds = convenientMerchantDTO.getServiceIds(); | 
|---|
|  |  |  | serviceIds.forEach(serviceId -> { | 
|---|
|  |  |  | ConvenientServiceCategoryDO convenientServiceCategoryDO = convenientServiceCategoryDAO.selectById(serviceId); | 
|---|
|  |  |  | convenientServiceCategoryDAO.createMerchantServiceRelation(merchantId, serviceId, | 
|---|
|  |  |  | convenientServiceCategoryDAO.createMerchantServiceRelation(Snowflake.getId(),merchantId, serviceId, | 
|---|
|  |  |  | convenientServiceCategoryDO.getName(), convenientMerchantDTO.getCreatedBy()); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | convenientServiceCategoryDAO.deleteMerchantServiceRelation(merchantId); | 
|---|
|  |  |  | serviceIds.forEach(serviceId -> { | 
|---|
|  |  |  | ConvenientServiceCategoryDO convenientServiceCategoryDO = convenientServiceCategoryDAO.selectById(serviceId); | 
|---|
|  |  |  | convenientServiceCategoryDAO.createMerchantServiceRelation(merchantId, serviceId, | 
|---|
|  |  |  | convenientServiceCategoryDAO.createMerchantServiceRelation(Snowflake.getId(),merchantId, serviceId, | 
|---|
|  |  |  | convenientServiceCategoryDO.getName(), convenientMerchantDTO.getCreatedBy()); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | id,`name`,icon,remark,weight,is_del,created_at,created_by,updated_at,updated_by | 
|---|
|  |  |  | </sql> | 
|---|
|  |  |  | <insert id="createMerchantServiceRelation"> | 
|---|
|  |  |  | INSERT INTO com_convenient_service_scope (merchant_id, service_category_id, service_name, created_by, created_at) | 
|---|
|  |  |  | VALUES (#{merchantId}, #{serviceId}, #{name}, #{createdBy}, NOW()) | 
|---|
|  |  |  | INSERT INTO com_convenient_service_scope (id,merchant_id, service_category_id, service_name, created_by, created_at) | 
|---|
|  |  |  | VALUES (#{id},#{merchantId}, #{serviceId}, #{name}, #{createdBy}, NOW()) | 
|---|
|  |  |  | </insert> | 
|---|
|  |  |  | <delete id="deleteMerchantServiceRelation"> | 
|---|
|  |  |  | DELETE FROM com_convenient_service_scope WHERE merchant_id = #{merchantId} | 
|---|