是否可以自动派生此界面:
<?php
$host="xxxxxxxx";
$dbName="xxxx";
$dbUser="xxxxxxxxxx";
$dbPass="xxxxxxxx";
$mr_id = $_POST['mr_id'];
$dbh = new PDO( "sqlsrv:server=".$host."; Database=".$dbName, $dbUser, $dbPass);
$dbh->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
//$sql = "SELECT DISTINCT CAST(MR_ID AS INT) AS MR_ID FROM Stage_Rebate_Index WHERE MR_ID = '$mr_id'";
//$sql_one = "SELECT CAST(Supp_ID AS INT) AS Supp_ID, CAST(MR_ID AS INT) AS MR_ID FROM Stage_Rebate_Index WHERE MR_ID = '$mr_id'";
$sql_one = "
SELECT
CONCAT(CAST(t1.MR_ID AS INT),' - ', COALESCE(t2.MR_Name, '')) AS MR_ID,
t1.MR_ID AS sort_column,
CAST(Supp_ID as INT) AS Supp_ID
FROM Stage_Rebate_Index t1
LEFT JOIN Stage_Rebate_Master t2
ON t2.MR_ID = t1.MR_ID
WHERE
CONCAT(CAST(t1.MR_ID AS INT),' - ', t2.MR_Name) = LTRIM(RTRIM('$mr_id'))
ORDER BY sort_column";
//$users = $dbh->query($sql);
$users_one = $dbh->query($sql_one);
?>
<html>
<body>
<!-- Table -->
<p>
<div id="table_div">
<table border="1" id="index_table" class="ui-widget ui-widget-content">
<thead>
<tr class="ui-widget-header">
<td>MR ID</td>
<td>Supplier ID</td>
</tr>
</thead>
<?php foreach($users_one->fetchAll() as $supp) { ?>
<tr>
<td class="mr_id"><?php echo $supp['MR_ID'];?></td>
<td class="supp_id"><?php echo $supp['Supp_ID'];?></td>
</tr>
<?php } ?>
</table>
</div>
</body>
</html>
来自这个
interface OverrideParamType {
foo?: FooType
bar?: BarType
}
用法是以:
结尾的函数interface ParamType {
foo: FooType
bar: BarType
}
答案 0 :(得分:6)
从打字稿2.1开始,你可以这样做:
interface ParamType {
foo: FooType
bar: BarType
}
type PartialParamType = Partial<ParamType>;
Partial
的定义是:
type Partial<T> = {
[P in keyof T]?: T[P];
};
有关详情:Mapped Types
请注意,您无需自行定义Partial
类型,它是lib.d.ts的一部分。