package com.alatus.service;
import com.alatus.model.TClue;
import com.github.pagehelper.PageInfo;
import java.io.InputStream;
public interface ClueService {
PageInfo
void importExcel(InputStream inputStream);
}
package com.alatus.service;
import com.alatus.model.TClue;
import com.github.pagehelper.PageInfo;
import java.io.InputStream;
public interface ClueService {
PageInfo
void importExcel(InputStream inputStream);
}
package com.alatus.service.impl;
import com.alatus.config.listener.UploadDataListener;
import com.alatus.constant.Constants;
import com.alatus.mapper.TClueMapper;
import com.alatus.model.TClue;
import com.alatus.query.BaseQuery;
import com.alatus.service.ClueService;
import com.alibaba.excel.EasyExcel;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import java.io.InputStream;
import java.util.List;
@Service
public class ClueServiceImpl implements ClueService {
@Resource
private TClueMapper tClueMapper;
@Override
public PageInfo
// 1.设置PageHelper
PageHelper.startPage(current, Constants.PAGE_SIZE);
// 2.查询
List
// 3.封装分页数据到PageInfo
PageInfo
return info;
}
@Override
public void importExcel(InputStream inputStream) {
// 第一个参数是文件,第二个参数是excel模板类,第三个是监听器
EasyExcel.read(inputStream,TClue.class,new UploadDataListener(tClueMapper)).sheet().doRead();
}
}
package com.alatus.service.impl;
import com.alatus.config.listener.UploadDataListener;
import com.alatus.constant.Constants;
import com.alatus.mapper.TClueMapper;
import com.alatus.model.TClue;
import com.alatus.query.BaseQuery;
import com.alatus.service.ClueService;
import com.alibaba.excel.EasyExcel;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import java.io.InputStream;
import java.util.List;
@Service
public class ClueServiceImpl implements ClueService {
@Resource
private TClueMapper tClueMapper;
@Override
public PageInfo
// 1.设置PageHelper
PageHelper.startPage(current, Constants.PAGE_SIZE);
// 2.查询
List
// 3.封装分页数据到PageInfo
PageInfo
return info;
}
@Override
public void importExcel(InputStream inputStream) {
// 第一个参数是文件,第二个参数是excel模板类,第三个是监听器
EasyExcel.read(inputStream,TClue.class,new UploadDataListener(tClueMapper)).sheet().doRead();
}
}
id, owner_id, activity_id, full_name, appellation, phone, weixin, qq, email, age,
job, year_income, address, need_loan, intention_state, intention_product, `state`,
`source`, description, next_contact_time, create_time, create_by, edit_time, edit_by
select
from t_clue
where id = #{id,jdbcType=INTEGER}
select
tc.*,
tu1.id ownerId, tu1.name ownerName,
ta.id activityId, ta.name activityName,
tdv.id appellationId, tdv.type_value appellationName,
tdv2.id needLoanId, tdv2.type_value needLoanName,
tdv3.id intentionStateId, tdv3.type_value intentionStateName,
tp.id intentionProductId, tp.name intentionProductName,
tdv4.id stateId, tdv4.type_value stateName,
tdv5.id sourceId, tdv5.type_value sourceName
from t_clue tc left join t_user tu1 on tc.owner_id = tu1.id
left join t_activity ta on tc.activity_id = ta.id
left join t_dic_value tdv on tc.appellation = tdv.id
left join t_dic_value tdv2 on tc.need_loan = tdv2.id
left join t_dic_value tdv3 on tc.intention_state = tdv3.id
left join t_product tp on tc.intention_product = tp.id
left join t_dic_value tdv4 on tc.state = tdv4.id
left join t_dic_value tdv5 on tc.source = tdv5.id
delete from t_clue
where id = #{id,jdbcType=INTEGER}
insert into t_clue (owner_id, activity_id, full_name,
appellation, phone, weixin,
qq, email, age, job,
year_income, address, need_loan,
intention_state, intention_product, `state`,
`source`, description, next_contact_time,
create_time, create_by, edit_time,
edit_by)
values (#{ownerId,jdbcType=INTEGER}, #{activityId,jdbcType=INTEGER}, #{fullName,jdbcType=VARCHAR},
#{appellation,jdbcType=INTEGER}, #{phone,jdbcType=VARCHAR}, #{weixin,jdbcType=VARCHAR},
#{qq,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{age,jdbcType=INTEGER}, #{job,jdbcType=VARCHAR},
#{yearIncome,jdbcType=DECIMAL}, #{address,jdbcType=VARCHAR}, #{needLoan,jdbcType=INTEGER},
#{intentionState,jdbcType=INTEGER}, #{intentionProduct,jdbcType=INTEGER}, #{state,jdbcType=INTEGER},
#{source,jdbcType=INTEGER}, #{description,jdbcType=VARCHAR}, #{nextContactTime,jdbcType=TIMESTAMP},
#{createTime,jdbcType=TIMESTAMP}, #{createBy,jdbcType=INTEGER}, #{editTime,jdbcType=TIMESTAMP},
#{editBy,jdbcType=INTEGER})
insert into t_clue
owner_id,
activity_id,
full_name,
appellation,
phone,
weixin,
qq,
email,
age,
job,
year_income,
address,
need_loan,
intention_state,
intention_product,
`state`,
`source`,
description,
next_contact_time,
create_time,
create_by,
edit_time,
edit_by,
#{ownerId,jdbcType=INTEGER},
#{activityId,jdbcType=INTEGER},
#{fullName,jdbcType=VARCHAR},
#{appellation,jdbcType=INTEGER},
#{phone,jdbcType=VARCHAR},
#{weixin,jdbcType=VARCHAR},
#{qq,jdbcType=VARCHAR},
#{email,jdbcType=VARCHAR},
#{age,jdbcType=INTEGER},
#{job,jdbcType=VARCHAR},
#{yearIncome,jdbcType=DECIMAL},
#{address,jdbcType=VARCHAR},
#{needLoan,jdbcType=INTEGER},
#{intentionState,jdbcType=INTEGER},
#{intentionProduct,jdbcType=INTEGER},
#{state,jdbcType=INTEGER},
#{source,jdbcType=INTEGER},
#{description,jdbcType=VARCHAR},
#{nextContactTime,jdbcType=TIMESTAMP},
#{createTime,jdbcType=TIMESTAMP},
#{createBy,jdbcType=INTEGER},
#{editTime,jdbcType=TIMESTAMP},
#{editBy,jdbcType=INTEGER},
insert into t_clue(`owner_id`, `activity_id`, `full_name`,
`appellation`, `phone`, `weixin`,
`qq`, `email`, `age`, `job`,
`year_income`, `address`, `need_loan`,
`intention_state`, `intention_product`, `state`,
`source`, `description`, `next_contact_time`,
`create_time`, `create_by`, `edit_time`,
edit_by)
values
(#{tClue.ownerId,jdbcType=INTEGER}, #{tClue.activityId,jdbcType=INTEGER}, #{tClue.fullName,jdbcType=VARCHAR},
#{tClue.appellation,jdbcType=INTEGER}, #{tClue.phone,jdbcType=VARCHAR}, #{tClue.weixin,jdbcType=VARCHAR},
#{tClue.qq,jdbcType=VARCHAR}, #{tClue.email,jdbcType=VARCHAR}, #{tClue.age,jdbcType=INTEGER}, #{tClue.job,jdbcType=VARCHAR},
#{tClue.yearIncome,jdbcType=DECIMAL}, #{tClue.address,jdbcType=VARCHAR}, #{tClue.needLoan,jdbcType=INTEGER},
#{tClue.intentionState,jdbcType=INTEGER}, #{tClue.intentionProduct,jdbcType=INTEGER}, #{tClue.state,jdbcType=INTEGER},
#{tClue.source,jdbcType=INTEGER}, #{tClue.description,jdbcType=VARCHAR}, #{tClue.nextContactTime,jdbcType=TIMESTAMP},
#{tClue.createTime,jdbcType=TIMESTAMP}, #{tClue.createBy,jdbcType=INTEGER}, #{tClue.editTime,jdbcType=TIMESTAMP},
#{tClue.editBy,jdbcType=INTEGER})
update t_clue
owner_id = #{ownerId,jdbcType=INTEGER},
activity_id = #{activityId,jdbcType=INTEGER},
full_name = #{fullName,jdbcType=VARCHAR},
appellation = #{appellation,jdbcType=INTEGER},
phone = #{phone,jdbcType=VARCHAR},
weixin = #{weixin,jdbcType=VARCHAR},
qq = #{qq,jdbcType=VARCHAR},
email = #{email,jdbcType=VARCHAR},
age = #{age,jdbcType=INTEGER},
job = #{job,jdbcType=VARCHAR},
year_income = #{yearIncome,jdbcType=DECIMAL},
address = #{address,jdbcType=VARCHAR},
need_loan = #{needLoan,jdbcType=INTEGER},
intention_state = #{intentionState,jdbcType=INTEGER},
intention_product = #{intentionProduct,jdbcType=INTEGER},
`state` = #{state,jdbcType=INTEGER},
`source` = #{source,jdbcType=INTEGER},
description = #{description,jdbcType=VARCHAR},
next_contact_time = #{nextContactTime,jdbcType=TIMESTAMP},
create_time = #{createTime,jdbcType=TIMESTAMP},
create_by = #{createBy,jdbcType=INTEGER},
edit_time = #{editTime,jdbcType=TIMESTAMP},
edit_by = #{editBy,jdbcType=INTEGER},
where id = #{id,jdbcType=INTEGER}
update t_clue
set owner_id = #{ownerId,jdbcType=INTEGER},
activity_id = #{activityId,jdbcType=INTEGER},
full_name = #{fullName,jdbcType=VARCHAR},
appellation = #{appellation,jdbcType=INTEGER},
phone = #{phone,jdbcType=VARCHAR},
weixin = #{weixin,jdbcType=VARCHAR},
qq = #{qq,jdbcType=VARCHAR},
email = #{email,jdbcType=VARCHAR},
age = #{age,jdbcType=INTEGER},
job = #{job,jdbcType=VARCHAR},
year_income = #{yearIncome,jdbcType=DECIMAL},
address = #{address,jdbcType=VARCHAR},
need_loan = #{needLoan,jdbcType=INTEGER},
intention_state = #{intentionState,jdbcType=INTEGER},
intention_product = #{intentionProduct,jdbcType=INTEGER},
`state` = #{state,jdbcType=INTEGER},
`source` = #{source,jdbcType=INTEGER},
description = #{description,jdbcType=VARCHAR},
next_contact_time = #{nextContactTime,jdbcType=TIMESTAMP},
create_time = #{createTime,jdbcType=TIMESTAMP},
create_by = #{createBy,jdbcType=INTEGER},
edit_time = #{editTime,jdbcType=TIMESTAMP},
edit_by = #{editBy,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
id, owner_id, activity_id, full_name, appellation, phone, weixin, qq, email, age,
job, year_income, address, need_loan, intention_state, intention_product, `state`,
`source`, description, next_contact_time, create_time, create_by, edit_time, edit_by
select
from t_clue
where id = #{id,jdbcType=INTEGER}
select
tc.*,
tu1.id ownerId, tu1.name ownerName,
ta.id activityId, ta.name activityName,
tdv.id appellationId, tdv.type_value appellationName,
tdv2.id needLoanId, tdv2.type_value needLoanName,
tdv3.id intentionStateId, tdv3.type_value intentionStateName,
tp.id intentionProductId, tp.name intentionProductName,
tdv4.id stateId, tdv4.type_value stateName,
tdv5.id sourceId, tdv5.type_value sourceName
from t_clue tc left join t_user tu1 on tc.owner_id = tu1.id
left join t_activity ta on tc.activity_id = ta.id
left join t_dic_value tdv on tc.appellation = tdv.id
left join t_dic_value tdv2 on tc.need_loan = tdv2.id
left join t_dic_value tdv3 on tc.intention_state = tdv3.id
left join t_product tp on tc.intention_product = tp.id
left join t_dic_value tdv4 on tc.state = tdv4.id
left join t_dic_value tdv5 on tc.source = tdv5.id
delete from t_clue
where id = #{id,jdbcType=INTEGER}
insert into t_clue (owner_id, activity_id, full_name,
appellation, phone, weixin,
qq, email, age, job,
year_income, address, need_loan,
intention_state, intention_product, `state`,
`source`, description, next_contact_time,
create_time, create_by, edit_time,
edit_by)
values (#{ownerId,jdbcType=INTEGER}, #{activityId,jdbcType=INTEGER}, #{fullName,jdbcType=VARCHAR},
#{appellation,jdbcType=INTEGER}, #{phone,jdbcType=VARCHAR}, #{weixin,jdbcType=VARCHAR},
#{qq,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{age,jdbcType=INTEGER}, #{job,jdbcType=VARCHAR},
#{yearIncome,jdbcType=DECIMAL}, #{address,jdbcType=VARCHAR}, #{needLoan,jdbcType=INTEGER},
#{intentionState,jdbcType=INTEGER}, #{intentionProduct,jdbcType=INTEGER}, #{state,jdbcType=INTEGER},
#{source,jdbcType=INTEGER}, #{description,jdbcType=VARCHAR}, #{nextContactTime,jdbcType=TIMESTAMP},
#{createTime,jdbcType=TIMESTAMP}, #{createBy,jdbcType=INTEGER}, #{editTime,jdbcType=TIMESTAMP},
#{editBy,jdbcType=INTEGER})
insert into t_clue
owner_id,
activity_id,
full_name,
appellation,
phone,
weixin,
qq,
email,
age,
job,
year_income,
address,
need_loan,
intention_state,
intention_product,
`state`,
`source`,
description,
next_contact_time,
create_time,
create_by,
edit_time,
edit_by,
#{ownerId,jdbcType=INTEGER},
#{activityId,jdbcType=INTEGER},
#{fullName,jdbcType=VARCHAR},
#{appellation,jdbcType=INTEGER},
#{phone,jdbcType=VARCHAR},
#{weixin,jdbcType=VARCHAR},
#{qq,jdbcType=VARCHAR},
#{email,jdbcType=VARCHAR},
#{age,jdbcType=INTEGER},
#{job,jdbcType=VARCHAR},
#{yearIncome,jdbcType=DECIMAL},
#{address,jdbcType=VARCHAR},
#{needLoan,jdbcType=INTEGER},
#{intentionState,jdbcType=INTEGER},
#{intentionProduct,jdbcType=INTEGER},
#{state,jdbcType=INTEGER},
#{source,jdbcType=INTEGER},
#{description,jdbcType=VARCHAR},
#{nextContactTime,jdbcType=TIMESTAMP},
#{createTime,jdbcType=TIMESTAMP},
#{createBy,jdbcType=INTEGER},
#{editTime,jdbcType=TIMESTAMP},
#{editBy,jdbcType=INTEGER},
insert into t_clue(`owner_id`, `activity_id`, `full_name`,
`appellation`, `phone`, `weixin`,
`qq`, `email`, `age`, `job`,
`year_income`, `address`, `need_loan`,
`intention_state`, `intention_product`, `state`,
`source`, `description`, `next_contact_time`,
`create_time`, `create_by`, `edit_time`,
edit_by)
values
(#{tClue.ownerId,jdbcType=INTEGER}, #{tClue.activityId,jdbcType=INTEGER}, #{tClue.fullName,jdbcType=VARCHAR},
#{tClue.appellation,jdbcType=INTEGER}, #{tClue.phone,jdbcType=VARCHAR}, #{tClue.weixin,jdbcType=VARCHAR},
#{tClue.qq,jdbcType=VARCHAR}, #{tClue.email,jdbcType=VARCHAR}, #{tClue.age,jdbcType=INTEGER}, #{tClue.job,jdbcType=VARCHAR},
#{tClue.yearIncome,jdbcType=DECIMAL}, #{tClue.address,jdbcType=VARCHAR}, #{tClue.needLoan,jdbcType=INTEGER},
#{tClue.intentionState,jdbcType=INTEGER}, #{tClue.intentionProduct,jdbcType=INTEGER}, #{tClue.state,jdbcType=INTEGER},
#{tClue.source,jdbcType=INTEGER}, #{tClue.description,jdbcType=VARCHAR}, #{tClue.nextContactTime,jdbcType=TIMESTAMP},
#{tClue.createTime,jdbcType=TIMESTAMP}, #{tClue.createBy,jdbcType=INTEGER}, #{tClue.editTime,jdbcType=TIMESTAMP},
#{tClue.editBy,jdbcType=INTEGER})
update t_clue
owner_id = #{ownerId,jdbcType=INTEGER},
activity_id = #{activityId,jdbcType=INTEGER},
full_name = #{fullName,jdbcType=VARCHAR},
appellation = #{appellation,jdbcType=INTEGER},
phone = #{phone,jdbcType=VARCHAR},
weixin = #{weixin,jdbcType=VARCHAR},
qq = #{qq,jdbcType=VARCHAR},
email = #{email,jdbcType=VARCHAR},
age = #{age,jdbcType=INTEGER},
job = #{job,jdbcType=VARCHAR},
year_income = #{yearIncome,jdbcType=DECIMAL},
address = #{address,jdbcType=VARCHAR},
need_loan = #{needLoan,jdbcType=INTEGER},
intention_state = #{intentionState,jdbcType=INTEGER},
intention_product = #{intentionProduct,jdbcType=INTEGER},
`state` = #{state,jdbcType=INTEGER},
`source` = #{source,jdbcType=INTEGER},
description = #{description,jdbcType=VARCHAR},
next_contact_time = #{nextContactTime,jdbcType=TIMESTAMP},
create_time = #{createTime,jdbcType=TIMESTAMP},
create_by = #{createBy,jdbcType=INTEGER},
edit_time = #{editTime,jdbcType=TIMESTAMP},
edit_by = #{editBy,jdbcType=INTEGER},
where id = #{id,jdbcType=INTEGER}
update t_clue
set owner_id = #{ownerId,jdbcType=INTEGER},
activity_id = #{activityId,jdbcType=INTEGER},
full_name = #{fullName,jdbcType=VARCHAR},
appellation = #{appellation,jdbcType=INTEGER},
phone = #{phone,jdbcType=VARCHAR},
weixin = #{weixin,jdbcType=VARCHAR},
qq = #{qq,jdbcType=VARCHAR},
email = #{email,jdbcType=VARCHAR},
age = #{age,jdbcType=INTEGER},
job = #{job,jdbcType=VARCHAR},
year_income = #{yearIncome,jdbcType=DECIMAL},
address = #{address,jdbcType=VARCHAR},
need_loan = #{needLoan,jdbcType=INTEGER},
intention_state = #{intentionState,jdbcType=INTEGER},
intention_product = #{intentionProduct,jdbcType=INTEGER},
`state` = #{state,jdbcType=INTEGER},
`source` = #{source,jdbcType=INTEGER},
description = #{description,jdbcType=VARCHAR},
next_contact_time = #{nextContactTime,jdbcType=TIMESTAMP},
create_time = #{createTime,jdbcType=TIMESTAMP},
create_by = #{createBy,jdbcType=INTEGER},
edit_time = #{editTime,jdbcType=TIMESTAMP},
edit_by = #{editBy,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
参考文章
发表评论